Hi experts,
I made a simple line graph using proc sgplot; however, I believe that combining the summary statistics table generated using the proc means command in the same plot may be more intuitive.Can anyone help with this. Attached: graph and table
Thank you,
Use an XAXISTABLE. Here is a simulation of how your code probably looks, and how you would use the XAXISTABLE. I put the variable on one statement, but you can put them on multiple statements if you want different visual attributes for each variable.
proc summary data=sashelp.class nway;
class age;
var weight;
output out=sumdata mean=mean median=median n=n;
run;
proc sgplot data=sumdata;
xaxis type=discrete;
series x=age y=n;
xaxistable n mean median;
run;
Hope this helps!
Dan
More helpful would be including the code you used to create the Proc Means output, the SGPLOT code and example data. Data is best provided as data step code to allow everyone to see the properties of variables and so we can run code against the created data.
Depending on the actual data set used for plotting you likely want an XAXISTABLE statement, if plotting the summarized data.
Otherwise you may want an annotate data set of the summarized values (likely more complex).
Thanks for the feedback, due to network issues I was unable to access the application and retrieve the info you required
Use an XAXISTABLE. Here is a simulation of how your code probably looks, and how you would use the XAXISTABLE. I put the variable on one statement, but you can put them on multiple statements if you want different visual attributes for each variable.
proc summary data=sashelp.class nway;
class age;
var weight;
output out=sumdata mean=mean median=median n=n;
run;
proc sgplot data=sumdata;
xaxis type=discrete;
series x=age y=n;
xaxistable n mean median;
run;
Hope this helps!
Dan
It works. Thank you!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.