Hi,
I am trying to create a line graph for pressure measurements made a various time points. Each time point variable contains pressure measurements for each subject (eg. t1, t2, t3, t4, etc.). These time point variables should each form my x-axis. The pressure measurements within each variable should me my y axis. I then have an intervention coded 1/0, for which I would like to dichotomize the data, creating two line graphs.
I am hoping to plot means with error bars (SD or SE).
I have tried to look through posts and synthax guides but I am not finding a way to plot the x-axis as being each of my t1, t2, t3, t4 etc variables.
I am using 9.4.
Please help!
Guillaume Martel
The best way to do this is to create a numeric variable (let's call it TIME) which has numbers 1 through 4, and then draw a plot of Y versus TIME.
For example: (untested code)
proc sgplot data=have;
series x=time y=y/group=intervention;
run;
1. Summarize your data so that it's ready to graph - don't expect SAS procs to do the calculations for you - that's a lot harder to get for a line chart specifically.
2. Use SGPLOT to create your graphics.
The graph gallery has many examples - see line chart.
Do you want a graph with two lines, two graphs side by side for easier comparison (SGPANEL) or two entirely separate graph objects?
@GMartel wrote:
Hi,
I am trying to create a line graph for pressure measurements made a various time points. Each time point variable contains pressure measurements for each subject (eg. t1, t2, t3, t4, etc.). These time point variables should each form my x-axis. The pressure measurements within each variable should me my y axis. I then have an intervention coded 1/0, for which I would like to dichotomize the data, creating two line graphs.
I am hoping to plot means with error bars (SD or SE).
I have tried to look through posts and synthax guides but I am not finding a way to plot the x-axis as being each of my t1, t2, t3, t4 etc variables.
I am using 9.4.
Please help!
Guillaume Martel
Thank you! I will review the documentation.
I can output the means + standard deviations/standard errors for team time point variable. Would you say that that is the simplest way to proceed?
I am hoping to create one graph with two lines. The actual line is optional. This is an example of what I am hoping to generate.
The HIGHLOW command of PROC SGPLOT will certainly create such a plot. You would have to compute the uppper and lower confidence interval limits yourself before running PROC SGPLOT.
Thank you I will give it a try!
GM
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.