BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
cdunlea
Fluorite | Level 6

Hello All, I am attempting to plot the means of 8 individual variables in my dataset over time. I am using SAS university so proc gplot is not an option. 

What I want is a way to take my proc means and plot it. So far nothing has worked. Here is the proc means I am running 

proc means data=wide_merged_file_sans_pooled mean stddev median min max;
var gmcsf_fuvisit_f0 gmcsf_fuvisit_f1 gmcsf_fuvisit_f2 gmcsf_fuvisit_f3 gmcsf_fuvisit_f5
gmcsf_fuvisit_f6 gmcsf_fuvisit_f7 gmcsf_fuvisit_f8; run;

 

I want to take the results of this proc means and plot it with an x-axis of "fuvisit"(each variable is a follow up visit) and a y axis of "Mean" along with standard deviation. 

 

Any advice is appreciated. 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
And it's likely easier if you add the LCLM and UCLM options to the PROC MEANS to get the lower and upper confidence limits of the mean if that's what you prefer.

View solution in original post

4 REPLIES 4
Reeza
Super User

When you post code please use a code block so that your code is formatted and legible.

 

proc means data=wide_merged_file_sans_pooled mean stddev median min max;
var gmcsf_fuvisit_f0 gmcsf_fuvisit_f1 gmcsf_fuvisit_f2 gmcsf_fuvisit_f3 gmcsf_fuvisit_f5
gmcsf_fuvisit_f6 gmcsf_fuvisit_f7 gmcsf_fuvisit_f8; 
run;

 

1. Save output from PROC MEANS to a data set

2. Graph data from data set

 

#1 is to add an ODS OUTPUT statement to capture the output, there are multiple ways to do this but this provides the data in a nice format for graphing. You do need to add the STACKODS option on the PROC MEANS statement as well.

proc means data=wide_merged_file_sans_pooled mean stddev median min max STACKODS;
var gmcsf_fuvisit_f0 gmcsf_fuvisit_f1 gmcsf_fuvisit_f2 gmcsf_fuvisit_f3 gmcsf_fuvisit_f5
gmcsf_fuvisit_f6 gmcsf_fuvisit_f7 gmcsf_fuvisit_f8; 
ods output summary = summaryStats;
run;

#2 Graph it

proc sgplot data=summaryStats;
vbarparm category = variable response=mean;
run;

@cdunlea wrote:

Hello All, I am attempting to plot the means of 8 individual variables in my dataset over time. I am using SAS university so proc gplot is not an option. 

What I want is a way to take my proc means and plot it. So far nothing has worked. Here is the proc means I am running 

proc means data=wide_merged_file_sans_pooled mean stddev median min max;
var gmcsf_fuvisit_f0 gmcsf_fuvisit_f1 gmcsf_fuvisit_f2 gmcsf_fuvisit_f3 gmcsf_fuvisit_f5
gmcsf_fuvisit_f6 gmcsf_fuvisit_f7 gmcsf_fuvisit_f8; run;

 

I want to take the results of this proc means and plot it with an x-axis of "fuvisit"(each variable is a follow up visit) and a y axis of "Mean" along with standard deviation. 

 

Any advice is appreciated. 


 

cdunlea
Fluorite | Level 6

Thank you Reeza!! It worked! Is there a way I can also add standard deviation to the graph as well?

Reeza
Super User
This is definitely possible, take a look at the VBARPARM documentation within SGPLOT and see what options it offers to add them on.
Hint: LIMITLOWER/LIMITUPPER

https://go.documentation.sas.com/?docsetId=grstatproc&docsetTarget=n0mc5dtithid5mn13c54dlgaceq3.htm&...

Reeza
Super User
And it's likely easier if you add the LCLM and UCLM options to the PROC MEANS to get the lower and upper confidence limits of the mean if that's what you prefer.

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!
Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 4 replies
  • 668 views
  • 4 likes
  • 2 in conversation