Date: Thu, 24 Feb 2011 10:10:03 -0800 "Nordlund, Dan (DSHS/RDA)" "SAS(r) Discussion" "Nordlund, Dan (DSHS/RDA)" Re: Calculating Mean Days text/plain; charset=utf-8

> -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of > Pashi, Arthur > Sent: Thursday, February 24, 2011 9:47 AM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Calculating Mean Days > > Dear SAS-L users, > > My survey data set looks like this: > > Obs asthma physhlth menthlth actlimit > > 1 2-No 0 0 2-No > 2 1-Yes 30 6 1-Yes > 3 2-No 15 0 1-Yes > 4 2-No 0 10 2-No > 5 2-No 2 20 1-Yes > 6 2-No 5 1 2-No > 7 2-No . 0 2-No > 8 2-No 14 0 2-No > > Note: asthma = has asthma (1-Yes), and no asthma (2-No) > physhlth = number of days with unhealthy physical health in past > 30 days > menthlth = number of days with unhealthy mental health in past > 30 days > actlimit = frequency (days) of activity limitation > > I want to calculate the following: > > > 1. Given asthma equal 1-yes, compute > > > > a. Mean physically unhealthy days > > b. Mean mentally unhealthy days > > c. Mean physically or mentally unhealthy days > > d. Mean days of activity limitation > > > 2. Given asthma equal 2-No, compute > > > > e. Mean physically unhealthy days > > f. Mean mentally unhealthy days > > g. Mean physically or mentally unhealthy days > > h. Mean days of activity limitation > > I have used proc means as follows: > > Data = ; > Set ; > if 1 le physhlth le 30 then phdnoasth = 1; > else if physhlth = 0 then phdnoasth = 0; > label phdnoasth= 'Mean physically unhealthy days in past 30'; > run; > > proc surveymeans data = ast.asthma07 mean clm; > strata vstrtum ; > weight finl_wt; > var phdnoasth mentdnoasth phmtdnoasth actlimnoasth; > domain asthma; > run; > > Instead of mean numbers of days, my results are rather percentages. > > Any help is welcome. > > Thank you > > Arthur K. Pashi

Arthur, To get your mean days of poor physical and mental health and activity limits, you don't need to create any new variables. The following should get you started.

proc surveymeans data = ast.asthma07 mean clm; strata vstrtum ; weight finl_wt; var physhlth menthlth actlimit; domain asthma; run;

I am not sure how you want to handle the mean days of poor physical or mental health. If someone has 20 days of poor physical health and 20 days of poor mental health, do you want to add those to yield 40 days of poor mental or physical health in the month, or something else?

Dan

Daniel J. Nordlund Washington State Department of Social and Health Services Planning, Performance, and Accountability Research and Data Analysis Division Olympia, WA 98504-5204

Back to: Top of message | Previous page | Main SAS-L page