
From  Richard Williams <[email protected]> 
To  [email protected], [email protected] 
Subject  Re: st: sum command 
Date  Mon, 23 Jan 2006 22:03:51 0500 
At 09:52 PM 1/23/2006, Baoyan Cheng wrote:
Hi, there,There may be other problems, but at a minimum get rid of the spaces between the function and the parentheses and also replace the commas with spaces, e.g.
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."
© Copyright 1996–2024 StataCorp LLC  Terms of use  Privacy  Contact us  What's new  Site index 