AXG
AXG

Reputation: 3

Archaic Stata v7 Code with Odd Macro References

I'm working with data from ICPSR for which a do file was written in Stata V7, around 2001. The do file notes that the program only runs in Version 7 (which is true). I'm having issues understanding parts of the code and I'm wondering if any of you more knowledgeable folks can help.

Here's an example block of the code:

program drop _all;
program define impact1;

scalar drop _all;

*First define proportions in your sample;

qui reg svy_cmove [pweight=`8'] if `1'~=. & t_exp_vs_ph==1;
scalar define ptmove=_b[_cons];

qui reg svy_cmove [pweight=`8'] if `1'~=. & t_s8_vs_ph==1;
scalar define ps8move=_b[_cons];

qui reg `6'  [pweight=`8'] if `1'~=.;
scalar define tprop=_b[_cons];

qui reg `7' [pweight=`8'] if `1'~=.;
scalar defin s8prop=_b[_cons];

*Need to svyset data to specify weight;

svyset pweight `8' ;

The code runs fine and performs what it is supposed to (replication of a table from a study), but what I don't understand is what the numbered references mean, for instance,

pweight= `8'

It refers to a total weight used in the survey, but I don't know how Stata makes the connection between the reference

`8' 

and the proper weight variable. Note that it is NOT defined at any point earlier in the do file. The code uses these references throughout the file when it runs a series of regressions to replicate the tables produced by the research team.

Any insight into how this process operates would be helpful so I can understand how Stata makes the connection between the variable and the number.

Upvotes: 0

Views: 97

Answers (1)

jorpppp
jorpppp

Reputation: 188

These are just positional arguments. 1 refers to the first word written after the program command, 2 to the second and so on. This is still standard in Stata

Here's an example

clear
program define positions
    di "`1'"
    di "`2'"
    di "`3'"
end
positions one two three

Presumably when you call the impact1 program, the eighth argument is the probability weight.

Upvotes: 3

Related Questions