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

Hello,

 

I'm making an effectplot from a proc plm based on a stored dataset output from a proc glimmix procedure. Here is my code:

 

 

Proc glimmix data=Data NOCLPRINT NOITPRINT METHOD= RSPL namelen=40;
CLASS id;model breakfast(ref='0')=restdur_PMC*restdur_PMC restdur_PMC restdur_PM*restdur_PM restdur_PM 
school_PMC / ODDSRATIO SOLUTION 
DIST=BINARY ddfm=bw;
store breakfast;
RANDOM Intercept / TYPE=AR(1) Subject=id;run; 
proc plm source= breakfast;effectplot fit(x=restdur_PMC);run;

The code produces the following graph:

sas effectplot graph.png

 

 

I want to make a series of changes to make the graph look more like the one below (except I want to have shaded confidence interval bands, not dotted lines as in the graph below):

 

sas forum graph example.png

 

Here is a list of the changes I would like:

 

  1. Make font size of axis numbering (to 12 pt) and axis titles bigger (to 14 pt)
  2. Bolded axis titles
  3. Change range of x-axis (to -4.00 to 4.00) and y-axis (to 0.45 to 0.85)
  4. Remove vertical gridlines
  5. Make 2 decimal points for x-axis and y-axis number format
  6. Change x-axis scale to 1.00 and y-axis scale to .05
  7. Change text for axis titles (x-axis, "Total Sleep Time (person-mean centered)," y-axis, "Predicted Probability of Breakfast Consumption")
  8. Change line color and shaded bands to black and gray, respectively
  9. Make line thicker (3 pt width)
  10. Make shaded bands the standard error of the mean, not 95% confidence intervals
  11. Delete chart title
  12. Remove chart border
  13. Remove "fit computed at . . ."

 

I tried looking up the options and making these changes myself, but I got bogged down with code and couldn't figure it out. A full list of the options available would be great as well.

 

Thanks for your help,

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Gotta log off shortly but this should get you started. 

 

Get the data from the PLM procedure not the GLIMMIX procedure so that you aren't recalculating anything, just changing the presentation. This is an older technique (Blog post is 2012 but predates this) but it requires no knowledge of templates or styles, just SGPLOT which is kind of the go to for SAS graphics these days. 

 

https://blogs.sas.com/content/iml/2012/08/01/data-fro-ods-graphics.html

 

Note that your PLM didn't work, I had to modify it to use the Samp data set. No idea if this may change things with your actual code but you may need to modify things slightly. 

From here it should be what options do you need in SGPLOT to control the appearance which are all well documented in the documentation for SGPLOT.

 

ods output fitplot =  effectPlotRawData;
proc plm source=samp_TST_Quad_Break;
effectplot fit(x=restdur_PMC);
run;

proc sgplot data=effectPlotRawData;
series x = _xcont1 y = _lclm / lineattrs=(color=red pattern=4);
series x = _xcont1 y= _uclm / lineattrs=(color = red pattern=4);
run;

View solution in original post

7 REPLIES 7
Reeza
Super User

It's quite painful to change the plots from PROCS. Instead, the standard recommendation is to pipe the data to a data set and then use SGPLOT to manually recreate the plot you need. 

 

Your plot is pretty straighforward so that should be easy enough within SGPLOT. 

All of the things you'd like to change are possible within SGPLOT.

 


@confooseddesi89 wrote:

Hello,

 

I'm making an effectplot from a proc plm based on a stored dataset output from a proc glimmix procedure. Here is my code:

 

 

Proc glimmix data=Data NOCLPRINT NOITPRINT METHOD= RSPL namelen=40;
CLASS id;model breakfast(ref='0')=restdur_PMC*restdur_PMC restdur_PMC restdur_PM*restdur_PM restdur_PM 
school_PMC / ODDSRATIO SOLUTION 
DIST=BINARY ddfm=bw;
store breakfast;
RANDOM Intercept / TYPE=AR(1) Subject=id;run; 
proc plm source= breakfast;effectplot fit(x=restdur_PMC);run;

The code produces the following graph:

sas effectplot graph.png

 

 

I want to make a series of changes to make the graph look more like the one below (except I want to have shaded confidence interval bands, not dotted lines as in the graph below):

 

sas forum graph example.png

 

Here is a list of the changes I would like:

 

  1. Make font size of axis numbering (to 12 pt) and axis titles bigger (to 14 pt)
  2. Bolded axis titles
  3. Change range of x-axis (to -4.00 to 4.00) and y-axis (to 0.45 to 0.85)
  4. Remove vertical gridlines
  5. Make 2 decimal points for x-axis and y-axis number format
  6. Change x-axis scale to 1.00 and y-axis scale to .05
  7. Change text for axis titles (x-axis, "Total Sleep Time (person-mean centered)," y-axis, "Predicted Probability of Breakfast Consumption")
  8. Change line color and shaded bands to black and gray, respectively
  9. Make line thicker (3 pt width)
  10. Make shaded bands the standard error of the mean, not 95% confidence intervals
  11. Delete chart title
  12. Remove chart border
  13. Remove "fit computed at . . ."

 

I tried looking up the options and making these changes myself, but I got bogged down with code and couldn't figure it out. A full list of the options available would be great as well.

 

Thanks for your help,



 

confooseddesi89
Quartz | Level 8

@Reeza wrote:

It's quite painful to change the plots from PROCS. Instead, the standard recommendation is to pipe the data to a data set and then use SGPLOT to manually recreate the plot you need. 

 

Your plot is pretty straighforward so that should be easy enough within SGPLOT. 

All of the things you'd like to change are possible within SGPLOT.

 



Okay, could you please provide me with instructions on that? Would it be by using "output out" to get a dataset with the predicted values, and then making an SGPLOT with that data?

 

Previously I used "output out" to get the predicted values and created my own line plot with those values and the standard error in Excel, but this doesn't work so well - the line in Excel doesn't follow the "true" trajectory of the effect that is seen in EFFECTPLOT. Someone else on this forum recommended I use EFFECTPLOT.

 

I should also add I tried SGPLOT on the predicted values using SERIES, REG, LOESS, AND PBSPLINE, and none of these options gave a curve remotely like EFFECTPLOT.

Reeza
Super User
Show what you tried or provide an example that we can also run...otherwise we'd have to recreate an example that had all the options you requested and answer your question. Fake data is fine, see the SASHELP library if you can use either the HEART BMI or CLASS data sets. If you can't do that for some reason here are some references to help you out:

ODS template modifications paper
https://support.sas.com/resources/papers/proceedings16/12260-2016.pdf

This paper has a good walkthrough of SGPLOT
https://www.lexjansen.com/wuss/2015/141_Final_Paper_PDF.pdf



confooseddesi89
Quartz | Level 8

Hi Reeza,

 

I've created a random sample of 5% of my data, below are the data (assigned to Work library:)

 

data Sample;
input id breakfast school_PMC restdur_PMC restdur_PM restend_PMC restend_PM;
datalines;
1010204 1 0 -0.38833 8.505 0.28833 9.0367
1010204 1 0 -1.24667 8.505 -0.87 9.0367
1010204 1 0 -1.305 8.505 -2.47 9.0367
1010204 1 0 1.995 8.505 2.44667 9.0367
1010204 1 0 0.945 8.505 0.605 9.0367
1010509 0 0 -0.61944 9.2694 -0.67778 9.1778
1010509 1 0 -0.47778 9.2694 -1.01944 9.1778
1010509 1 0 1.09722 9.2694 1.69722 9.1778
1025352 1 0 1.31944 8.4806 1.44861 11.8097
1025352 1 0 0.96944 8.4806 0.44861 11.8097
1025352 0 0 0.60278 8.4806 0.57361 11.8097
1025352 1 0 -2.69722 8.4806 -1.38472 11.8097
1025352 1 0 2.19444 8.4806 -0.52639 11.8097
1025352 1 0 -2.38889 8.4806 -0.55972 11.8097
1025491 0 -0.6 0.905 5.6617 0.81667 9.1
1025491 0 0.4 -0.12833 5.6617 -1.61667 9.1
1025491 0 0.4 -1.43667 5.6617 -1.74167 9.1
1025491 0 0.4 -1.57833 5.6617 -1.28333 9.1
1025491 0 -0.6 2.23833 5.6617 3.825 9.1
1052393 1 0.28571 0.0881 7.9869 -0.6381 8.1131
1052393 1 0.28571 -2.09524 7.9869 -1.02976 8.1131
1052393 1 0.28571 -0.22857 7.9869 -0.52143 8.1131
1052393 1 0.28571 -0.4619 7.9869 0.07857 8.1131
1052393 1 -0.71429 0.3631 7.9869 1.20357 8.1131
1052393 1 -0.71429 1.77143 7.9869 0.69524 8.1131
1052393 1 0.28571 0.5631 7.9869 0.2119 8.1131
1065615 0 0.5 -0.81875 7.3438 -1.47708 7.3188
1065615 0 0.5 -2.26042 7.3438 -1.80208 7.3188
1065615 1 -0.5 1.89792 7.3438 1.97292 7.3188
1065615 1 -0.5 1.18125 7.3438 1.30625 7.3188
2000529 1 0 2.99792 9.3438 0.175 11.0833
2000529 1 0 -2.11042 9.3438 0.56667 11.0833
2000529 1 0 -0.74375 9.3438 -0.06667 11.0833
2003678 0 -0.57143 0.64881 7.7929 0.95595 7.219
2003678 0 0.42857 0.04048 7.7929 0.22262 7.219
2003678 0 0.42857 -1.10952 7.7929 0.04762 7.219
2003678 0 0.42857 -0.35119 7.7929 -0.08571 7.219
2003678 0 -0.57143 0.66548 7.7929 -0.37738 7.219
2003678 0 -0.57143 0.35714 7.7929 -0.22738 7.219
2003678 0 0.42857 -0.25119 7.7929 -0.53571 7.219
2006280 1 -0.42857 0.78571 8.0226 2.38929 8.6357
2006280 1 -0.42857 -0.43095 8.0226 -0.62738 8.6357
2006280 1 -0.42857 1.06905 8.0226 0.77262 8.6357
2006280 1 -0.42857 -0.01429 8.0226 2.17262 8.6357
2006280 1 0.57143 1.78571 8.0226 -1.70238 8.6357
2006280 1 0.57143 -1.61429 8.0226 -1.24405 8.6357
2006280 1 0.57143 -1.58095 8.0226 -1.76071 8.6357
2016364 1 -0.66667 2.50139 7.3236 1.52639 7.0903
2016364 1 -0.66667 -0.44028 7.3236 2.13472 7.0903
2016364 0 0.33333 -2.41528 7.3236 -1.09028 7.0903
2016364 1 0.33333 -0.70694 7.3236 -1.07361 7.0903
2016364 1 0.33333 0.75972 7.3236 -0.65694 7.0903
2016364 1 0.33333 0.30139 7.3236 -0.84028 7.0903
2100953 1 0.33333 -0.27222 7.6889 0.09444 6.9972
2100953 1 -0.66667 -0.64722 7.6889 0.30278 6.9972
2100953 1 0.33333 0.91944 7.6889 -0.39722 6.9972
2100966 1 0.33333 -2.46667 6.725 -2.325 7
2100966 1 -0.66667 2.35833 6.725 2.65 7
2100966 1 0.33333 0.10833 6.725 -0.325 7
2401076 0 0.2 -0.20167 8.7433 -0.07 7.0033
2401076 0 0.2 -0.05167 8.7433 -0.98667 7.0033
2401076 1 -0.8 -0.04333 8.7433 1.19667 7.0033
2401076 0 0.2 -0.135 8.7433 -0.35333 7.0033
2401076 0 0.2 0.43167 8.7433 0.21333 7.0033
2505312 1 -0.6 4.41167 8.93 4.455 8.8783
2505312 1 -0.6 2.13667 8.93 2.72167 8.8783
2505312 0 0.4 -3.68833 8.93 -2.60333 8.8783
2505312 1 0.4 -0.155 8.93 -2.17 8.8783
2505312 1 0.4 -2.705 8.93 -2.40333 8.8783
2606114 1 -0.33333 1.73889 8.9694 2.71111 9.5139
2606114 1 -0.33333 2.64722 8.9694 3.07778 9.5139
2606114 1 -0.33333 -1.04444 8.9694 -1.47222 9.5139
2606114 1 0.66667 -1.80278 8.9694 -2.88889 9.5139
2606114 1 0.66667 -1.39444 8.9694 -2.63056 9.5139
2606114 1 -0.33333 -0.14444 8.9694 1.20278 9.5139
2705675 1 0 -1.00333 8.8117 -2.355 11.005
2705675 1 0 2.205 8.8117 0.42833 11.005
2705675 1 0 0.155 8.8117 0.73667 11.005
2705675 1 0 0.19667 8.8117 0.21167 11.005
2705675 1 0 -1.55333 8.8117 0.97833 11.005
2800046 1 -0.57143 1.07143 7.7536 1.0131 7.1536
2800046 1 0.42857 -0.7619 7.7536 -0.8119 7.1536
2800046 1 0.42857 -0.3869 7.7536 -0.79524 7.1536
2800046 1 0.42857 -0.77857 7.7536 -0.8619 7.1536
2800046 1 0.42857 -0.54524 7.7536 -0.8369 7.1536
2800046 1 -0.57143 1.62976 7.7536 2.02976 7.1536
2800046 1 -0.57143 -0.22857 7.7536 0.2631 7.1536
2808284 1 0.28571 -0.16429 4.5393 -4.8881 6.4381
2808284 1 0.28571 1.55238 4.5393 0.04524 6.4381
2808284 1 -0.71429 2.01071 4.5393 4.8869 6.4381
2808284 1 0.28571 -2.32262 4.5393 -0.7131 6.4381
2808284 1 -0.71429 1.55238 4.5393 2.5619 6.4381
2808284 1 0.28571 -0.86429 4.5393 -0.94643 6.4381
2808284 1 0.28571 -1.76429 4.5393 -0.94643 6.4381
2900344 1 0.28571 -0.41786 7.6262 -0.99643 6.7464
2900344 1 -0.71429 3.32381 7.6262 2.40357 6.7464
2900344 1 -0.71429 0.30714 7.6262 1.54524 6.7464
2900344 1 0.28571 -0.60119 7.6262 -0.7381 6.7464
2900344 1 0.28571 -0.45119 7.6262 -0.75476 6.7464
2900344 1 0.28571 -0.28452 7.6262 -0.6631 6.7464
2900344 1 0.28571 -1.87619 7.6262 -0.79643 6.7464
3002199 1 0 0.26944 7.1972 1.31389 7.7361
3002199 1 0 -1.48056 7.1972 -0.92778 7.7361
3002199 1 0 0.67778 7.1972 0.13056 7.7361
3002199 1 0 -1.19722 7.1972 -1.57778 7.7361
3002199 1 0 0.51944 7.1972 -0.22778 7.7361
3002199 1 0 1.21111 7.1972 1.28889 7.7361
3500727 1 -0.625 2.24271 7.9406 3.14688 7.5365
3500727 1 0.375 -1.12396 7.9406 -1.29479 7.5365
3500727 1 0.375 -1.09063 7.9406 -1.73646 7.5365
3500727 1 0.375 -1.59063 7.9406 -1.74479 7.5365
3500727 1 0.375 -1.97396 7.9406 -1.79479 7.5365
3500727 1 0.375 -1.16563 7.9406 -1.49479 7.5365
3500727 0 -0.625 3.80104 7.9406 3.57188 7.5365
3500727 1 -0.625 0.90104 7.9406 1.34688 7.5365
4500166 1 0.33333 -1.4625 7.5875 -1.04583 6.5625
4500166 1 -0.66667 2.44583 7.5875 3.04583 6.5625
4500166 0 -0.66667 0.07083 7.5875 0.4625 6.5625
4500166 0 0.33333 -0.34583 7.5875 -1.02083 6.5625
4500166 1 0.33333 0.0875 7.5875 -0.40417 6.5625
4500166 0 0.33333 -0.79583 7.5875 -1.0375 6.5625
5005356 0 0 1.17083 7.8042 0.81458 8.1854
5005356 0 0 -0.54583 7.8042 -0.80208 8.1854
5005356 1 0 0.52917 7.8042 1.02292 8.1854
5005356 1 0 -1.15417 7.8042 -1.03542 8.1854
6108126 1 0 -2.03333 5.9667 -0.21042 7.6188
6108126 1 0 1.13333 5.9667 0.05625 7.6188
6108126 1 0 0.21667 5.9667 -0.16875 7.6188
6108126 1 0 0.68333 5.9667 0.32292 7.6188
6200943 0 0 3.79167 10.1083 2.28472 9.4736
6200943 0 0 1.55833 10.1083 0.90139 9.4736
6200943 0 0 -4.31667 10.1083 -4.82361 9.4736
6200943 1 0 -1.65 10.1083 1.47639 9.4736
6200943 0 0 0.325 10.1083 -0.15694 9.4736
6200943 1 0 0.29167 10.1083 0.31806 9.4736
6602127 1 -0.71429 2.44643 9.0619 2.56071 7.506
6602127 1 -0.71429 1.84643 9.0619 3.34405 7.506
6602127 1 0.28571 -0.9869 9.0619 -0.64762 7.506
6602127 1 0.28571 -1.37857 9.0619 -1.06429 7.506
6602127 1 0.28571 -0.47024 9.0619 -1.64762 7.506
6602127 1 0.28571 -0.85357 9.0619 -1.71429 7.506
6602127 1 0.28571 -0.60357 9.0619 -0.83095 7.506
6602334 1 0.16667 0.50556 7.5028 -0.26528 6.3986
6602334 1 -0.83333 0.94722 7.5028 1.94306 6.3986
6602334 1 0.16667 -0.02778 7.5028 -0.57361 6.3986
6602334 1 0.16667 -0.81944 7.5028 -0.10694 6.3986
6602334 1 0.16667 -0.36944 7.5028 -0.74028 6.3986
6602334 1 0.16667 -0.23611 7.5028 -0.25694 6.3986
7003071 1 0 0.94643 6.4369 0.75952 11.7988
7003071 1 0 0.2631 6.4369 0.48452 11.7988
7003071 1 0 0.6881 6.4369 1.00119 11.7988
7003071 1 0 1.57976 6.4369 0.88452 11.7988
7003071 1 0 -3.75357 6.4369 -3.33214 11.7988
7003071 1 0 2.27143 6.4369 1.74286 11.7988
7003071 1 0 -1.99524 6.4369 -1.54048 11.7988
7602773 1 0 1.22857 7.1381 2.42381 6.8429
7602773 1 0 -1.62143 7.1381 -1.86786 6.8429
7602773 1 0 -0.8131 7.1381 0.14048 6.8429
7602773 1 0 0.42024 7.1381 0.28214 6.8429
7602773 1 0 1.0619 7.1381 -0.09286 6.8429
7602773 1 0 -0.77976 7.1381 -1.68452 6.8429
7602773 1 0 0.50357 7.1381 0.79881 6.8429
;

 

 

Below is the code I used for proc glimmix for the predictors restdur_PMC and restdur_PM (which are quadratic):

 

Proc glimmix data=Sample NOCLPRINT NOITPRINT METHOD= RSPL namelen=40;
CLASS id;
model breakfast(ref='0')=restdur_PMC*restdur_PMC restdur_PMC restdur_PM*restdur_PM restdur_PM
school_PMC / ODDSRATIO SOLUTION DIST=BINARY ddfm=bw;
output out=Samp_TST_Quad_Break pred (blup ilink)=TST_Quad_Break_Pred
pred(noblup ilink)=TST_Quad_Break_Pred_PA
STDERR(blup ilink)=TST_Quad_Break_STDERR STDERR(noblup ilink)=TST_Quad_Break_STDERR_PA;
RANDOM Intercept / TYPE=AR(1) Subject=id;
store samp_TST_Quad_Break;
Title 'TST_quad predicting breakfast, adjusted';
run;title;run;

Below is the code I used for proc glimmix for the predictors restend_PMC and restend_PM (which are linear):

 

Proc glimmix data=Sample NOCLPRINT NOITPRINT METHOD= RSPL namelen=40;
CLASS id;
model breakfast(ref='0')=restend_PMC restend_PM school_PMC / ODDSRATIO SOLUTION DIST=BINARY ddfm=bw;
output out=Samp_offset_Break pred (blup ilink)= offset_Break_Pred
pred(noblup ilink)= offset_Break_Pred_PA
STDERR(blup ilink)= offset_Break_STDERR STDERR(noblup ilink)= offset_Break_STDERR_PA;
RANDOM Intercept / TYPE=AR(1) Subject=id;
store samp_offset_Break;
Title 'offset predicting breakfast, adjusted';
run;title;run;

Below is the code for an effectplot for the predictor restdur_PMC:

 

proc plm source=TST_Quad_Break;
effectplot fit(x=restdur_PMC);
run;

This produced the effectplot below:

Effectplot 1.png

Below is the code for an effectplot for the predictor restend_PMC:

proc plm source=offset_Break;
effectplot fit(x=restend_PMC);
run;

This produced the effectplot below:

Effectplot 2.png

 

Below are the codes I've tried for the sgplots for the predictor restdur_PMC:

/*series*/
proc sgplot data=Samp_TST_Quad_Break;
series X=restdur_PMC y=TST_Quad_Break_Pred_PA;
xaxis grid values = (-4.5 to 4.5 by 2);
yaxis grid values = (0 to 1 by .2);
run;
/*REG*/
proc sgplot data=Samp_TST_Quad_Break;
REG X=restdur_PMC y=TST_Quad_Break_Pred_PA;
xaxis grid values = (-4.5 to 4.5 by 2);
yaxis grid values = (0 to 1 by .2);
run;
/*LOESS*/
proc sgplot data=samp_TST_Quad_Break;
Loess X=restend_PMC y=TST_Quad_Break_Pred_PA;
xaxis grid values = (-4.5 to 4.5 by 2);
yaxis grid values = (0 to 1 by .2);
run;
/*PBSPLINE*/
proc sgplot data=Samp_TST_Quad_Break;
PBSPLINE X=restdur_PMC y=TST_Quad_Break_Pred_PA;
xaxis grid values = (-4.5 to 4.5 by 2);
yaxis grid values = (0 to 1 by .2);
run;

Below are the codes I've tried for the sgplots for the predictor restend_PMC:

/*series*/
proc sgplot data=Samp_Offset_Break;
series X=restend_PMC y=Offset_Break_Pred_PA;
xaxis grid values = (-5 to 5 by 2);
yaxis grid values = (0 to 1 by .2);
run;
/*REG*/
proc sgplot data=Samp_Offset_Break;
REG X=restend_PMC y=Offset_Break_Pred_PA;
xaxis grid values = (-5 to 5 by 2);
yaxis grid values = (0 to 1 by .2);
run;
/*LOESS*/
proc sgplot data=Samp_Offset_Break;
LOESS X=restend_PMC y=Offset_Break_Pred_PA;
xaxis grid values = (-5 to 5 by 2);
yaxis grid values = (0 to 1 by .2);
run;
/*PBSPLINE*/
proc sgplot data=Samp_Offset_Break;
PBSPLINE X=restend_PMC y=Offset_Break_Pred_PA;
xaxis grid values = (-5 to 5 by 2);
yaxis grid values = (0 to 1 by .2);
run;

With the sample data, the Loess curve for restdur_PMC looks a bit like the effectplot (but not as "smooth" and a bit flatter), while the Reg curve for restend_PMC looks similar to the effectplot. See below the Loess sgplot for restdur_PMC:

Loess restdur_PMC.png

See below the Reg sgplot for restend_PMC:

Reg restend_PMC.png

 

However, these do not look the same with the entire dataset (loess curve for restdur_PMC is too flat compared to effectplot, and reg curve for restend_PMC goes in the opposite direction). I could DM you the data for the entire dataset if that would be helpful (I would prefer not to include entire dataset on a public forum).

 

Thanks.

 

Reeza
Super User

Gotta log off shortly but this should get you started. 

 

Get the data from the PLM procedure not the GLIMMIX procedure so that you aren't recalculating anything, just changing the presentation. This is an older technique (Blog post is 2012 but predates this) but it requires no knowledge of templates or styles, just SGPLOT which is kind of the go to for SAS graphics these days. 

 

https://blogs.sas.com/content/iml/2012/08/01/data-fro-ods-graphics.html

 

Note that your PLM didn't work, I had to modify it to use the Samp data set. No idea if this may change things with your actual code but you may need to modify things slightly. 

From here it should be what options do you need in SGPLOT to control the appearance which are all well documented in the documentation for SGPLOT.

 

ods output fitplot =  effectPlotRawData;
proc plm source=samp_TST_Quad_Break;
effectplot fit(x=restdur_PMC);
run;

proc sgplot data=effectPlotRawData;
series x = _xcont1 y = _lclm / lineattrs=(color=red pattern=4);
series x = _xcont1 y= _uclm / lineattrs=(color = red pattern=4);
run;
confooseddesi89
Quartz | Level 8

Excellent. That worked. In case anyone is wondering, here is the full code.

Proc glimmix data=Data NOCLPRINT NOITPRINT METHOD= RSPL namelen=40;
CLASS id;
model breakfast(ref='0')=restdur_PMC*restdur_PMC restdur_PMC restdur_PM*restdur_PM restdur_PM school_PMC  / ODDSRATIO SOLUTION 
DIST=BINARY ddfm=bw;store TST_quad_break;
RANDOM Intercept / TYPE=AR(1) Subject=id; 
run; 

ods output fitplot =  Fit_TST_Quad_Break;
proc plm source=TST_Quad_Break;
effectplot fit(x=restdur_PMC);
run;
ODS GRAPHICS / RESET  HEIGHT = 4.9in WIDTH = 6.83in;
proc sgplot data=Fit_TST_Quad_Break noautolegend;
series x = _XCONT1 y = _PREDICTED / lineattrs=(color=black pattern=SOLID thickness=3);
band X=_XCONT1 lower=_lclm upper=_uclm / fillattrs=(color=black transparency=.85);xaxis values = (-4 to 4 by 2) label='Total Sleep Time (person-mean centered)'
LABELATTRS=(size=14 weight=bold) VALUEATTRS=(size=12 weight=bold);
yaxis grid values = (.6 to .85 by .05) label='Breakfast Consumption' LABELATTRS=(size=14 weight=bold)
VALUEATTRS=(size=12 weight=bold) GRIDATTRS=(color=GrayCA thickness=.1mm);run;

The below graph was produced:

 

SGPlot2.png

 

The only thing I could not do was to make the grid lines transparent, which is not an option in GRIDATTRS.

-confooseddesi89

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 4037 views
  • 1 like
  • 2 in conversation