Hello all,
I want to use sashelp.class as an example to get mean and SE (standard error) values of height by proc mixed and I like to save these values in a dataset. I found all the SE values are the exactly the same. This is my first time to touch proc mixed, so I really get confused. Anyone can give me some explanation? Thanks.
proc mixed data=sashelp.class(where=(Age in (14,15))); class Sex Age; model Height = Sex Age; lsmeans Sex Age; run;
Here is output:
I think that's what is supposed to happen with the SE when you estimate some type of linear model for the two-way ANOVA case, and there are equal number of observations in each cell.
Hi @PaigeMiller , anyway to correct it, because I guess those numbers should not be equal. Thanks.
@lc7033907 wrote:
Hi @PaigeMiller , anyway to correct it, because I guess those numbers should not be equal. Thanks.
You are incorrect. The SE numbers should be equal in this example.
@PaigeMiller Thank you. Now let me modify my real problem and I hope to get some hints. The following is data that I have
data have;
input subjid $2. Avisitc $3-10 trt $ CHG;
datalines;
1 week 12 A 3.7
1 week 16 A 4.8
2 week 12 B -2
2 week 16 B -2.2
3 week 12 A -3
3 week 16 A -2.5
4 week 12 B 2.8
4 week 16 B 3.0
5 week 12 A 7.0
5 week 16 A 7.1
6 week 12 B 6.4
6 week 16 B 6.8
7 week 12 A -5
7 week 16 A -5.4
8 week 12 B 10
8 week 16 B 11
9 week 12 B -6.4
9 week 16 B -7.1
10 week 12 A 6.3
10 week 16 A 6.9
;
I want to get a report in the following:
Now I have trouble on the last column, because I never use proc mixed before. Any hints are appreciated. Thanks.
You can get most of this from PROC MIXED
ods select lsmeans;
proc mixed data=have;
class avisitc trt;
model chg = avisitc*trt;
lsmeans avisitc*trt;
run;
quit;
If it has to be displayed EXACTLY as shown, then that is a job for other PROCs, and I would recommend you start another thread to discuss how to display results exactly in the desired report form.
Thank you so much @PaigeMiller . Your code is exactly the same as what I did on my own. Since I got the same values on SE, I thought I was wrong. Thank you once again.
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.