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

I ran the following codes to graphically show the predicted probabilities of y (binary) vs. x1 (continuous) at different values of x2 (continuous). 

proc logistic data=data;
   model y(event='1') = x1 | x2;
   store logiMod;
run;

title "Predicted probabilities";
proc plm source=logiMod;
   effectplot slicefit(x=x1 sliceby=x2=0 to 30 by 5);
run;

These codes give me the graph for the whole range of x1. But I want to show this graph for a specified range of x1 (say, for 0-20 with an increment of 2 for grids) without changing my main model. How can I get that? Can anyone demostrate any alternative way to produce a similar graph if such an option is not available in proc plm? 

 

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

For more flexibility, you could skip proc plm and do your own scoring. For example:

 

data heart;
set sashelp.heart;
alive = missing(ageAtDeath);
run;

data graphValues;
do smoking = 0, 10, 20, 30;
    do systolic = 120 to 180;
        output;
        end;
    end;
label 
    smoking="Cigarettes per day" 
    systolic="Systolic blood pressure";
run;

proc logistic data=heart;
model alive = systolic smoking;
score data=graphValues out=graphScores;
run;

proc sgplot data=graphScores;
series x=systolic y=p_0 / group=smoking lineattrs=(pattern=solid);
run;

SGPlot2.png

PG

View solution in original post

2 REPLIES 2
PGStats
Opal | Level 21

For more flexibility, you could skip proc plm and do your own scoring. For example:

 

data heart;
set sashelp.heart;
alive = missing(ageAtDeath);
run;

data graphValues;
do smoking = 0, 10, 20, 30;
    do systolic = 120 to 180;
        output;
        end;
    end;
label 
    smoking="Cigarettes per day" 
    systolic="Systolic blood pressure";
run;

proc logistic data=heart;
model alive = systolic smoking;
score data=graphValues out=graphScores;
run;

proc sgplot data=graphScores;
series x=systolic y=p_0 / group=smoking lineattrs=(pattern=solid);
run;

SGPlot2.png

PG

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 1028 views
  • 1 like
  • 2 in conversation