BookmarkSubscribeRSS Feed
sasbee
Fluorite | Level 6

The sliceby function in Proc plm effectplot automatically produces 5 equally spaced category for the continuous variable, I am wondering if there way to change the 5 groups to other number of group?

 

Thanks. 

4 REPLIES 4
data_null__
Jade | Level 19

SLICEFIT

Displays a curve of predicted values versus a continuous variable grouped by the levels of a CLASS effect.

Rick_SAS
SAS Super FREQ

Sure. Look at the examples in the article "Use the EFFECTPLOT statement to visualize regression models in SAS."

In that article is the following code that plots the CigsPerDay variable at the five levels {0, 15, 30, 45, 60}.

 

proc plm source=logiModel;
   effectplot slicefit(x=MomAge sliceby=CigsPerDay);
run;

To override the default, list the levels of the CigsPerDay variable. For example, use either of the following syntaxes:

 

proc plm source=logiModel;
   effectplot slicefit(x=MomAge sliceby=CigsPerDay=5 25 45); /* three values */
run;

proc plm source=logiModel;
   effectplot slicefit(x=MomAge sliceby=CigsPerDay=(0 to 60 by 5));/* 13 values */
run;

 

Ameribrit
Calcite | Level 5

Hi Rick: this may be a stupid question but when I run the following code:

ods graphics on;
proc logistic data=mapmerge plots=effect;
class Shock_Vasopressor__Use(ref='No') respmechvent(ref='No') Renal_Failure_HD_Use (ref='No') Grade_3_4_Hepenceph(ref='Yes')/param=ref;

model ICU_DEATH(EVENT='Yes')=twamap55 meld_na_score respmechvent Renal_Failure_HD_Use Shock_Vasopressor__Use albumin wbc Grade_3_4_Hepenceph/clodds=wald;
UNITS twamap55= -1 ;
store adjMort;
run;

 

 

SAS produces a default effects plot (see attachment)

 

 

I am trying to understand how SAS produces this plot and if I can reproduce it using Proc plm so I can create my own combinations if needed.

 

So far I am trying the following code but I cant seem to slice by multiple categorical predictors ( if I assume thats what SAS is doing to produce the plot) the at values work but I dont know how to mimic whats labelled on the xaxis 

 



/*test plm*/
proc plm restore=adjMort;
effectplot slicefit (x=twamap55 sliceby=Shock_Vasopressor__Use*respmechvent*Renal_Failure_HD_Use) / at( Grade_3_4_Hepenceph='Yes' meld_na_score=mean albumin=mean wbc=mean);
run;

 

If I just use one var in sliceby I get a plot but not the default one SAS produces.

Thanks Rick and sorry for the long winded question

Francis

 

Rick_SAS
SAS Super FREQ

As you suspected, you cannot use the EFFECTPLOT statement in PROC PLM to create that graph. However, you can create the graph manually by creating a scoring data set and using the SCORE statement in PR....

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 4 replies
  • 1699 views
  • 0 likes
  • 4 in conversation