I got some intercept and slopes from proc mixed effect model, like the following table show.
I want to make line graph using those intercept (25.00) and slope (0.040). How to do it in SAS?
OK. This is a different model that in your initial post, To display this model, use the SLICEFIT(sliceby=sex) option. The doc for PROC PLM is here.
You might also want to read the article "Use the EFFECTPLOT statement to visualize regression models in SAS."
proc plm restore=MixStore;
effectplot slicefit( sliceby=Sex );
run;
PROC SGPLOT with the LINEPARM statement will do this. Maybe PROC PLM will also do this, I don't know, I never tried.
Thank you for the reply. However, the LINEPARM must be used with another plot statement.
Then get creative — plot data that is transparent and can't be seen. Example:
proc sgplot data=sashelp.class;
scatter x=height y=weight/transparency=1;
lineparm x=0 y=26.8 slope=0.335;
xaxis min=0 max=200 label='Timepoint';
yaxis min=0 max=200 label='Y';
run;
Or look into using PROC PLM by saving the output of the PROC MIXED using the STORE command in PROC MIXED. https://documentation.sas.com/?cdcId=pgmmvacdc&cdcVersion=9.4&docsetId=statug&docsetTarget=statug_in...
Interesting idea.
It works now.
Thanks for your help.
You can do this with PROC PLM without needing to hard-code the estimates. In your PROC MIXED call, add the STORE statement, such as
store out=MixStore;
Then call PROC PLM and use the EFFECTPLOT statement:
proc plm restore=MixStore;
effectplot fit; /* or use the noclm option to suppress the CLM */;
run;
Thanks for the reply.
I did the graph using proc plm but it was not what I want. It only gave me one line representing the sex=1 but I want to show two lines for sex=0 and sex=1 (shown in the estimate table), respectively.
Show us the LOG for PROC PLM (not just any errors that may be in the log, but the entire log for the PROC PLM step).
Please click on the {i} icon and paste the log as text into that window.
There is no error in the LOG. I attached with my code for mixed and plm.
%macro mix_group(dataset,group); proc sort data=&dataset; by L_PNR; run; proc mixed data=&dataset; class t &group; model col1=timepoint &group &group*timepoint /solution ddfm=kr; repeated t /subject=L_PNR type=un; estimate "intercept:&group=0" intercept 1 &group 0 1 /cl; estimate "intercept:&group=1" intercept 1 &group 1 0 /cl; estimate "intercept:1-0" intercept 0 &group 1 -1 /cl; estimate "slope for &group=0" timepoint 1 &group*timepoint 0 1 /cl; estimate "slope for &group=1" timepoint 1 &group*timepoint 1 0 /cl; estimate "slope for &group 1- &group 0" timepoint 0 &group*timepoint 1 -1 /cl; store MixStore; run; %mend; %mix_group(atl_two_bmi_3,sex); proc plm restore=MixStore; effectplot fit; run;
OK. This is a different model that in your initial post, To display this model, use the SLICEFIT(sliceby=sex) option. The doc for PROC PLM is here.
You might also want to read the article "Use the EFFECTPLOT statement to visualize regression models in SAS."
proc plm restore=MixStore;
effectplot slicefit( sliceby=Sex );
run;
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 25. 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.