Announcement

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

  • Error in running WHO macro

    Hi users,

    I am trying to compute z scores for survey data using WHO macro (http://www.who.int/childgrowth/software/en/). However, I am repeatedly getting error that file could not be loaded despite presence of file in the folder.

    Code:
     /* Indicate to the Stata compiler where the who2007.ado file is stored*/
    . adopath + "\\ad....\Documents\who2007_stata"
      [1]  (BASE)      "C:\Program Files (x86)\Stata13\ado\base/"
      [2]  (SITE)      "C:\Program Files (x86)\Stata13\ado\site/"
      [3]              "."
      [4]  (PERSONAL)  "c:\ado\personal/"
      [5]  (PLUS)      "c:\ado\plus/"
      [6]  (OLDPLACE)  "c:\ado/"
      [7]              "\ad.........\who2007_stata"
    
    
     /* Load the data file */
    . use "\\ad.......\Documents\who2007_work\survey.dta", clear
    
    . /* generate the first three parameters reflib, datalib & datalab        */
    . gen str60 reflib="\\ad.....\Documents\who2007_stata\"
    . lab var reflib "Directory of reference tables"
    .
    . gen str60 datalib="\\ad.........\Documents\who2007_stata\"
    . lab var datalib "Directory for datafiles"
    
    . gen str30 datalab="survey"
    . lab var datalab "Working file"
    
     /*      Fill in the macro parameters to run the command */
    . who2007 reflib datalib datalab sex agemons ageunit weight height oedema sw
    
    Please wait, programme is running.............
    
    ..............................................
    file \\ad.........\Documents\who2007_stata\wfawho2007.dta not found
    r(601);
    
    end of do-file
    
    r(601);
    When I check physically file `wfawho2007.dta' is in the "who2007_stata" folder. I cannot understand the reason for getting this error, is there anything that I need to write "Fill in the macro parameters" line or in the adopath line. The computer that I am working is a university networked computer. Can this be a source for error?

    Thank you
    Last edited by Sanu Sharma; 24 Jul 2016, 20:57.

  • #2
    Is your path to the datasets longer than 60 characters? Based upon the comment, it seems that the ado-file is storing the path to the dataset in a variable of 60 characters' length.

    Also,if your path has spaces in it, then it would need to be surounded by double-quotation marks, and it doesn't look as if the assignment to the "datalib" variable is doing that. It would look like
    Code:
    generate str datalib = char(34) + "\\ad.........\Documents\who2007_stata\" + char(34)
    I know nothing about this ado-file other than what you show, but you also might want to make sure that if it needs you to tell it where to find the datasets, then you would need to provide the correct path through the university network to the directory where you have put the datasets.

    Comment


    • #3
      Thank You Joseph. I think your solution solved my issue but I again ran into another problem. Now after running the codes as earlier it is giving following error.

      Code:
       /*      Fill in the macro parameters to run the command */
      . who2007 reflib datalib datalab sex agemons ageunit weight height oedema sw 
      
      Please wait, programme is running.............
      
      ..............................................
      varlist not allowed
      r(101);
      
      end of do-file
      
      r(101);
      I suppose this has to do with ado file programming. Could you please let me know the reason I am getting such error? FYI I have included the ado file as an attachment. Perhaps it would be a good idea to contact WHO personnel who wrote the macro.

      Thanks,
      Attached Files

      Comment

      Working...
      X