Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Varlist error

    There is an error in this line,

    qui nmissing, min(*)

    putexcel set "`output_loc'\missing_values.xlsx", sheet("All values missing") replace
    local i=2
    putexcel A1= ("Variables which have all values missing")
    foreach j of varlist `r(varlist)'{
    quietly{
    putexcel A`i'= ("`j'")
    }
    local i=`i'+1
    }

    Error is varlist required.

  • #2
    nmissing is an old STB command considered by its author (me) to be superseded by missings from the Stata Journal.


    Code:
    SJ-15-4 dm67_4  . . . . . . . . . . . . . . . . . Software update for nmissing
            (help nmissing if installed)  . . . . . . . . . . . . . . .  N. J. Cox
            Q4/15   SJ 15(4):1186--1187
            nmissing command has been superseded by a new command, missings,
            which offers various utilities for managing variables that may
            have missing values
    
    SJ-5-4  dm67_3  . . . . . . . . . .  Software update for nmissing and npresent
            (help nmissing if installed)  . . . . . . . . . . . . . . .  N. J. Cox
            Q4/05   SJ 5(4):607
            now produces saved results
    
    SJ-3-4  sg67_2  . . . . . . . . . .  Software update for nmissing and npresent
            (help nmissing, npresent if installed)  . . . . . . . . . .  N. J. Cox
            Q4/03   SJ 3(4):449
            updated to include support for by, options for checking
            string values that contain spaces or periods, documentation
            of extended missing values .a to .z, and improved output
    
    STB-60  dm67.1  . . . .  Enhancements to numbers of missing and present values
            (help nmissing if installed)  . . . . . . . . . . . . . . .  N. J. Cox
            3/01    pp.2--3; STB Reprints Vol 10, pp.7--9
            updated with option for reporting on observations
    
    STB-49  dm67  . . . . . . . . . . . . .  Numbers of missing and present values
            (help nmissing if installed)  . . . . . . . . . . . . . . .  N. J. Cox
            5/99    pp.7--8; STB Reprints Vol 9, pp.26--27
            commands to list the numbers of missing values and nonmissing
            values in each variable in varlist

    That said, what is going on here? My guess is that r(varlist) has disappeared by the time you ask for its contents. Your could try something like


    Code:
    qui nmissing, min(*)
    local missvars `r(varlist)' 
    
    putexcel set "`output_loc'\missing_values.xlsx", sheet("All values missing") replace
    local i=2
    putexcel A1= ("Variables which have all values missing")
    foreach j of local missvars { 
    
    quietly putexcel A`i'= ("`j'")
    
    local i=`i'+1
    }

    Comment

    Working...
    X