0
votes

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.

1
Hi, AXG, and welcome to the site! Unfortunately, this is really a Stata question, not a statistics question, and you'd almost certainly be better served on stackoverflow (the programmer site) than here (the statistics site.) Either way, it looks like a real puzzle, and I hope you find an answer somewhere.jbowman
I agree with @jorpppp. On the evidence here there is nothing archaic about this code; it is just that how to call it is not documented here. By the way, a statement version 7 (if that is implied here) means that version 7 of Stata (or greater) is required, not that it will run only in version 7.Nick Cox

1 Answers

3
votes

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.