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.
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.
Thank you Reeza!! It worked! Is there a way I can also add standard deviation to the graph as well?
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.