It's working! However, I am getting slightly (like, 1 or 2 percent of the total value) differences between the estimates that I had gotten with my original code and those with the new ones. The difference between the two estimates for the income variable is the same with both codes. Is this probably just an issue of rounding at some point? As long as the difference is the same it is fine for my purposes, I'm just curious. Thank you again, I really appreciate all of your help!
... View more
I'm sorry, that was a typo, here is the corrected code. ods select LsMeanCoef; proc glm data=soda.info; where cals ne . & income ne . & weekend ne . & inschool ne .& school=0; class income weekend gender; model cals= weekend gender age income; weight 6yr; lsmeans income /e; run; quit; proc surveyreg data=soda.info; where cals ne . & weekend ne . & income ne . & inschool ne . & school=0; stratum stra; cluster psu; class income weekend gender; model cals= weekend gender age income; weight 6yr; estimate 'lsmeans for low income' intercept 1 weekend 0.2857 0.7143 gender 0.5 0.5 age 9.34660158 income 1 0; estimate 'lsmeans for high income' intercept 1 weekend 0.2857 0.7143 gender 0.5 0.5 age 9.34660158 incomel 0 1; run; Thank you again for your help!
... View more
The (.75, .25) ratio refers to a weekend variable in a population that was oversampled for weekends, where whether the sample was taken on a weekday or weekend is something that we want to adjust for. My proc glm statement is: ods select LsMeanCoef; proc glm data=soda.info; where cals ne . & income ne . & weekend ne . & inschool ne .& school=0; class income weekend gender; model cals= weekend gender age income; weight 6yr; lsmeans income /e; run; quit; and the surveyreg statement is, where I've input the coefficients from the glm statement except for weekend, which I'm doing as 2/7 and 5/7 proc surveyreg data=soda.info; where cals ne . & weekend ne . & income ne . & inschool ne . & school=0; stratum stra; cluster psu; class income weekend gender; model cals= weekend gender age income; weight 6yr; estimate 'lsmeans for school' intercept 1 weekend 0.2857 0.7143 gender 0.5 0.5 age 9.34660158 inschool 1 0; estimate 'lsmeans for summer' intercept 1 weekend 0.2857 0.7143 gender 0.5 0.5 age 9.34660158 inschool 0 1; run;
... View more
Great, thanks! My only other concern is that one of my class variables is closer to a (.75, 0.25) ratio and as far as I know GLM automatically outputs the coefficients as (0.5, 0.5). So, when I input the coefficients into SURVEYREG, I change them manually. Do you think there is a way to get around this, as well? I'm sorry if there is a straightforward go-around, I am new to this. Thank you for your help.
... View more
Doing it that way has worked, but I am doing many iterations and was hoping that I could find a way that I could do through a macro. Given that each of my trials has different conditions, I have to reenter the coefficients in proc surveyreg for each of them. I am hoping that there is a one-step alternative.
... View more
Hi, I am trying to get find predicted means but the version of SAS that I have will not let me do that through proc survey reg. I know that I can do it through proc glm, but I also need to use clustering. I tried the method described here, http://support.sas.com/kb/24/497.html But is there an alternative way to get predicted means? Thank you.
... View more