Announcement

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

  • #31
    Are you entering this in the command window? You can't use /// in the command window. /// is only allowed when running a do-file.

    More generally, when you find code here on Statalist, unless somebody says otherwise, you should assume that it is meant to be run in a do-file, not from the command window. Similarly, when posting code of your own here, if you are doing it in the command window, you should say so, since there are things (like ///) that work differently there, and people will assume, unless you say otherwise, that you are running your code from a do file.

    Last edited by Clyde Schechter; 09 Jun 2024, 23:25.

    Comment


    • #32
      What is more, such code must be run from a do-file or do-file editor window all at once, not line by line.

      Comment


      • #33
        Originally posted by Nick Cox View Post
        What is more, such code must be run from a do-file or do-file editor window all at once, not line by line.
        Thanks Very Much Nick. Unformately I have made all the chages you have suggested but still getting Variable Groups not found.

        Comment


        • #34
          Read #31 and #32 again and try this

          Code:
          gen groups= 1 * inlist(countrycode1, "SYC", "NAM", "BWA", "GNQ", "GAB", "LBY", "MUS", "ZAF") + ///
          2 * inlist(countrycode1, "AGO", "DZA", "BEN", "CIV", "CMR", "COG", "COM", "CPV", "DJI") + ///
          2 * inlist(countrycode, "EGY", "GHA", "KEN", "LSO", "MAR", "MRT", "NGA", "SEN", "STP") + ///
          2 * inlist(countrycode, "TUN", "TZA", "ZWE", "SWZ") + ///
          3 * inlist(countrycode, "BDI", "BFA", "CAF", "COD", "ERI" , "ETH", "GIN" , "GMB" , "LBR" ) + ///
          3 * inlist(countrycode, "MLI" , "MOZ", "MWI" , "NER", "RWA", "SDN", "SLE", "SOM" , "SSD")+ ///
          3 * inlist(countrycode, "TGO", "UGA", "ZMB", "MDG" ,"TCD")
          
          label def gnames 1 "Upper Income" 2 "lower middle Income" 3 "Low Income"
          
          label val groups gnames
          label var groups "Countrycode income groups"
          Note that the first command refers to countrycode and countrycode1.

          Comment

          Working...
          X