| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: sum command
Hi, there,
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.
Baoyan
_________________________________________
Baoyan Cheng
Doctoral Student
Administration, Planning and Social Policy
Harvard Graduate School of Education
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/