BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Jie111
Quartz | Level 8

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?

 

11.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

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;

View solution in original post

10 REPLIES 10
PaigeMiller
Diamond | Level 26

PROC SGPLOT with the LINEPARM statement will do this. Maybe PROC PLM will also do this, I don't know, I never tried.

 

 

--
Paige Miller
Jie111
Quartz | Level 8

Thank you for the reply. However, the LINEPARM must be used with another plot statement.

It is not possible to do like following:
 
proc sgplot;
lineparm x=0 y=26.8 slope=0.335;
run;
PaigeMiller
Diamond | Level 26

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...

 

 

--
Paige Miller
Jie111
Quartz | Level 8

Interesting idea.

It works now.

 

Thanks for your help.

Rick_SAS
SAS Super FREQ

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;

 

Jie111
Quartz | Level 8

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.

 

Annotation 2019-09-04 155935.png

PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
Jie111
Quartz | Level 8

 

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;




Annotation 2019-09-04 162725.png

Rick_SAS
SAS Super FREQ

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;

Jie111
Quartz | Level 8
Thanks. It is very helpful and powerful.

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!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 10 replies
  • 2675 views
  • 4 likes
  • 3 in conversation