BookmarkSubscribeRSS Feed
diversitygal
Calcite | Level 5

Hi,

 

I have used SAS before but I am very new and I am struggling to create a visual of my data. I would like to create a graph similar to the one displayed below. I have the pre and post data 10 years before and 10 years after AZA use. I tried using PROC MIXED and PROC SGPLOT below but I am not getting anywhere close to this graph. Please help.

Proc Mixed Data=import;
Class time;
Model fvc = time / DDFM=KenwardRoger; 
Repeated time / Subject=id Type=ANTE(1) R RCorr;
Run;

PROC SGPLOT DATA=import NOAUTOLEGEND; 
SERIES X=time Y=fvc / GROUP=id; 
RUN;

graph.jpg

1 REPLY 1
SteveDenham
Jade | Level 19

Well, I think you are going to need PROC NLMIXED if you want to duplicate those graphs as they fit a segmented model which is something that PROC MIXED doesn't do without some major coding.  The key is to include a PREDICT statement with the out= option to get the predicted values and confidence bounds into a dataset.

However, your PROC MIXED code treats time as a categorical variable, so you can get output with breaks at each time point.  Simply add outp=predicted to your model statement.  This will give you a dataset named "predicted" with the estimate for each time point, as well as upper and lower (1-alpha) confidence bounds.  Take that dataset as your input to PROC SGPLOT.  This note https://support.sas.com/kb/42/542.html  will help walk you through the plot. Note that some of the data shaping steps won't be needed as you already have the estimate and the lower and upper bounds.

 

SteveDenham

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 1 reply
  • 805 views
  • 0 likes
  • 2 in conversation