BookmarkSubscribeRSS Feed
Fluorite | Level 6

Hi! I hope my title makes sense and my problem also makes sense!


I'm comparing lsmeans of groups of people who meet exercise minute guidelines (variable=guideline_levels, and the groupings are none, insufficient, adequate, and high). And I want to look at their cardiovascular score (iCVH). With the guideline_levels, I want to group compare means by APO (adverse pregnancy outcomes).


FYI: The other variables in my code are age, time between visits, race, insurance status, and smoking status. These are just additional variables for my model.


Below is a graph I have, but it's not what I'm going for. I would like to have the guideline_levels together. sas.PNG

proc glm data= exercise.analyticsample;
	class guideline_levels (ref='None') APO crace Insurance Smoking;
	model iCVH_v5 = guideline_levels age_at_v1 time_bw_cv_ped crace Insurance Smoking APO guideline_levels*APO;
	lsmeans guideline_levels*APO / cl obsmargins;
Super User

What exactly does "Below is a graph I have, but it's not what I'm going for. I would like to have the guideline_levels together. ". Together where?


From what I see the x axis values are "together", as in "Adequate" is together.

If you mean the 0/1 suffix then you should pay attention to that order. If your variable is CHARACTER it will sort alphabetically by default for the Xaxis variable. If you want the 0/1 together change the value to start with 0 or 1.

Otherwise provide actual data as a working data set and tell us explicitly what order you want, where.


I also don't see any plot options in your code.

Fluorite | Level 6

I was talking about grouping the guideline_levels as one. I would like to have 4 values in the x-axis, and not 8. 

Super User

Create a format that groups variable values.

Maybe (since I am still not sure which actual groups you want)

Proc format;
value $guide
'Adequate 0', 'Adequate 1' ='Adequate'
<repeat as needed, I'm too lazy to type a bunch of stuff from a picture>

and add to your GLM code:

format Guideline_levels $guide. ;
You will need to change the Class reference value to the new formatted value as well.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 2 in conversation