## Programming the statistical procedures from SAS

Occasional Contributor
Posts: 18

I have the following code to generate predicted probabilities of child death when education=edu1 at different origin of births (SADC, ROA, and SA). However, I want to set the continuous regressors to their mean, some categorical regressors to 1, and some categorical regressors to 0. Can you help me code these "adjustments"?

What I have:

proc qlim data=sa.Ipumsi_sa_reg;
model CHDIED=SADC ROA AGE EDU2 EDU3 EDU4 EDU5 EDU6 MARRIED PERSONS EMPLOY OWNER URBAN_I URBAN_F IMOVER RECENT / DISCRETE(d=probit);
weight WTPER;
where OSEAS=0 and 20 le AGE le 35 and EDU1=1;
output out=outpp_edu1 proball;
run;
quit;

proc means data=outpp_edu1;
var Prob2_CHDIED;
run;

proc means data=outpp_edu1;
var Prob2_CHDIED;
where roa=1;
run;

proc means data=outpp_edu1;
var Prob2_CHDIED;
where sa=1;
run;

Thank you!
Stephanie

Posts: 5,056

## Re: Getting "adjusted" predicted probabilities

I am not a user of proc qlim. So this is just an educated guess of how to get your predictions. The idea is to add extra observations with missing dependent values. The extra obs will not be used for estimation but the procedure will compute predicted values for them.

``````/* Create 3 combinations of binary predictors where predictions
are wanted */

data predBin;
input
label :\$5./
EDU1 EDU2 EDU3 EDU4 EDU5 EDU6 /
MARRIED EMPLOY OWNER /
URBAN_I URBAN_F IMOVER RECENT;
datalines;
1 0 0
1 0 0 0 0 0
1 0 1
0 1 0 1
ROA
0 1 0
1 0 0 0 0 0
1 0 1
0 1 0 1
OSEAS
0 0 1
1 0 0 0 0 0
1 0 1
0 1 0 1
;

proc sql;

/* Compute the means of continuous predictors */
create table predMeans as
select mean(age) as age, mean(persons) as persons
from sa.lpumsi_sa_reg;

/* Merge binary and continuous predictors */
create table predValues as
select predBin.*, predMeans.*
from predBin, predMeans;

/* Add the extra observations to original data */
create table lpumsi_sa_reg as
select "DATA" as label length=5, * from  sa.lpumsi_sa_reg
union all corr
select . as chdied, 1 as wtper, * from predValues;
quit;

proc qlim data=Ipumsi_sa_reg;
model CHDIED=SADC ROA OSEAS AGE EDU1 EDU2 EDU3 EDU4 EDU5 EDU6
MARRIED PERSONS EMPLOY OWNER URBAN_I URBAN_F IMOVER RECENT / DISCRETE(d=probit);
weight WTPER;
output out=outpp proball;
run;``````

(untested)

PG
Occasional Contributor
Posts: 18

## Re: Getting "adjusted" predicted probabilities

Thank you PGStats.

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