Search code examples
stata

What does the following Stata code mean (x/max=.)?


I do not know Stata and I need to know what the following code means. I understand that prtvtacy gets recoded to 1 if it is 1 and 0 else. But what does recode prtvtacy (66/max=.) mean?

*cyprus
tab prtvtacy
tab prtvtacy, nolab
recode prtvtacy (66/max=.)
 
recode winlose 0=1 if prtvtacy==1

Solution

  • Here are inline comments for each line. Note that variable in Stata means what is most often called a column in many other programming languages.

    *cyprus                            // <- This is a comment
    tab prtvtacy                       // <- This shows the frequency of the variable prtvtacy
    tab prtvtacy, nolab                // <- Same as above, but shows numeric code instead of label
    recode prtvtacy (66/max=.)         // <- Any value in variable prtvtacy between 66 and the highest value is changed to missing value (.)
     
    recode winlose 0=1 if prtvtacy==1  // <- Set variable winlose to 1 for observations where winlose is 0 and prtvtacy is 1