Statistical Procedures

Programming the statistical procedures from SAS
BookmarkSubscribeRSS Feed
knighsson
Obsidian | Level 7

Hello.

 

I want to get a table as follows: (this is the proc means results)

111111111111.PNG

 

however, when I used proc surveymeans, code are below

proc surveymeans data=nh.outcomes;
   STRATA sdmvstra;  
CLUSTER sdmvpsu;  
var BMXBMI;
CLASS alpha16; 
WEIGHT glucwt4yr;
domain eligible;
run;

I only get the table like this:

22222222222.PNG

 

could you please tell what went wrong?

 

Thank you!

 

3 REPLIES 3
knighsson
Obsidian | Level 7
In my code, I have two domains (eligible=1 or 2), but when I changed my code,

proc surveymeans data=nh.outcomes_joint_240 nomcar;
STRATA sdmvstra;
CLUSTER sdmvpsu;
var BMXBMI;
CLASS alpha16 age RIAGENDR PIR SDDSRVYR RIDRETH1;
WEIGHT glucwt4yr;
domain eligible;
by alpha16;
run;
it did not work as well. then I changed the code like below, it worked.

proc surveymeans data=nh.outcomes_joint_240 nomcar;
STRATA sdmvstra;
CLUSTER sdmvpsu;
var BMXBMI;
CLASS alpha16 age RIAGENDR PIR SDDSRVYR RIDRETH1;
WEIGHT glucwt4yr;
domain alpha16;
run;

But I wonder is this the right code since I did not use my domain variable.

Thank you!
PGStats
Opal | Level 21

I think the problem with the first code version is the BY statement. It requests a separate analysis for each value of alpha16. Try keeping the DOMAIN eligible statement but dropping the BY statement.

 

You will also need the MISSING option in the proc surveymeans statement, otherwise your eligible=2 domain will be ignored.

PG
knighsson
Obsidian | Level 7
the eligible domain has been defined as follows:

data nh.outcomes;
set nh.outcome;
if alpha16=. then eligible=2;
else eligible=1;
run;

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1381 views
  • 0 likes
  • 2 in conversation