BookmarkSubscribeRSS Feed
Saifulinfs
Fluorite | Level 6

I used the following code to get a slicefit plot (shown below) through the effectplot statement in Proc PLm

 

proc sort data=zinc.imputed out=zinc.imputed_srtd; by zns_unic; run;
proc surveyreg data=zinc.imputed_srtd;
weight nat_weight_bio;
cluster psu_no_ov;
strata newstrata;
class SEX area handwashing p_activity;
Format SEX SEX. handwashing $handwashing. p_activity p_act.;
effect znspln = spline(zns_unic / naturalcubic basis=tpf(noint) knotmethod=PERCENTILELIST(5 27.5 50 72.5 95));
model N_Mets7 = znspln AGE_in_yr sex handwashing p_activity /solution CLPARM;
output out=N_Mets7_Out predicted=Pred lcl=Lower ucl=Upper;
store N_Mets7_MODEL;
run;
proc plm SOURCE = N_Mets7_MODEL; EFFECTPLOT FIT (X=ZNS_UNIC)/ CLM; ODS OUTPUT FITPLOT = zinc.N_Mets7_FIT; RUN;

Saifulinfs_0-1699703121288.png

Would you let me know is there any option to change the appearance of the slicefit type of plot through proc SGPLOT? I tried the following code but the curves and straight lines seem weird. I only need two curves with 95% confidence band; one for males and one for females.

 

PROC SGPLOT DATA=zinc.mean_sbp_FIT NOAUTOLEGEND;
BAND UPPER = _UCLM LOWER = _LCLM X=_XCONT1/TRANSPARENCY=.3;
SERIES Y = _PREDICTED X=_XCONT1;
XAXIS LABEL = "Serum zinc concentration (µg/dL)";
yaxis label = "Predicted systolic blood pressure (mm Hg)";
title "A";
title2 "Fit for mean systolic blood pressure with 95% confidence limits";
run;

Saifulinfs_1-1699703402992.png

 

3 REPLIES 3
StatDave
SAS Super FREQ

The PLM plot that you show is a SLICEFIT plot, but your code does not request that and other items in the plot are not compatible with your code. However, since the plot you show is a SLICEFIT type of plot with SLICEBY=SEX, you need to specify GROUP=_GROUP in both your BAND and in your SERIES statements.

Saifulinfs
Fluorite | Level 6

Sorry, that was a typo in the code; its actually a slicefit.  I understood I needed to use the group= option in my band and series statements. But the following code does not store the _Group variable in the Fitplot "zinc.N_Mets7_Fit"

 

proc plm SOURCE = N_Mets7_MODEL;

EFFECTPLOT slicefit (X=ZNS_UNIC sliceby = sex)/ CLM;

ODS OUTPUT FITPLOT = zinc.N_Mets7_FIT;

RUN;

 

the only variables are following: 

Saifulinfs_0-1699720369980.png

As a result, Proc sgplot shows error that _group variable was not found

StatDave
SAS Super FREQ

_GROUP should be there just as in this example:

proc surveyreg data=sashelp.cars;
class origin;
effect s=spline(enginesize/naturalcubic);
model mpg_city=s origin horsepower;
store sr;
run;
proc plm restore=sr;
EFFECTPLOT sliceFIT (X=enginesize sliceby=origin)/ CLM; 
ODS OUTPUT sliceFITPLOT = fp;
run;
PROC SGPLOT DATA=fp NOAUTOLEGEND; 
BAND UPPER = _UCLM LOWER = _LCLM X=_XCONT1/TRANSPARENCY=.3 group=_group;
SERIES Y = _PREDICTED X=_XCONT1/group=_group;
run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 3 replies
  • 1028 views
  • 2 likes
  • 2 in conversation