[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: sum command
Does anyone know the correct command for doing sum in STATA?
I need to add together seven variables to form one measure called “anxiety.” I could simply add
all the seven variables together, but STATA would drop any observation that misses one of the
seven variables. I want STATA to treat missing values as 0 if at least one of the seven variables
is not missing, and that's what the command “sum” is supposed to do (I thought).
I tried the following commands, but none of them worked:
1)egen anxi_sum=rsum (careopin, nervoppsex,nervsocial, nervpublic, worrlaug, worrdrop, worrburd)
2)egen anxi_sum=sum (careopin, nervoppsex,nervsocial, nervpublic, worrlaug, worrdrop, worrburd)
3)gen anxi_sum=sum (careopin, nervoppsex,nervsocial, nervpublic, worrlaug, worrdrop, worrburd)
The first was said to be "invalid syntax"; the second one "variables in the parentheses are
invalid names"; and the third one "sum not found."
Any feedback will be really appreciated.
Administration, Planning and Social Policy
Harvard Graduate School of Education
* For searches and help try: