Programming the statistical procedures from SAS

Can PROC HPLOGISTIC output Parameter Estimate to a SAS dataset

Accepted Solution Solved
Reply
New Contributor
Posts: 3
Accepted Solution

Can PROC HPLOGISTIC output Parameter Estimate to a SAS dataset

I am using SAS 9.4.

Does PROC HPLOGISTIC has an option similar to OUTEST of PROC LOGISTIC?

I know HPLOGISTIC has CODE option which would produce the SAS code to score a future datset, but my concern is to output the parameter estimates in a format easily manipulatable by a downstream process for automation.

Could this be done in HPLOGISTIC, say by using an ODS statement to capture them?

Thank you!


Accepted Solutions
Solution
Wednesday
SAS Super FREQ
Posts: 3,307

Re: Can PROC HPLOGISTIC output Parameter Estimate to a SAS dataset

It's always best to use one of the SASHELP sample data sets so that everyone can access the data and run the code.

You are correct: that the OUTEST option in HPLOGISTIC works differently than for PROC LOGISTIC. However, what Reeza is saying is that you can use the statement

ODS OUTPUT ParameterEstimates=HPLogiPE;

to convert the ParameterEstimates table to a SAS data set. See the article "ODS OUTPUT: Store any statistic created by any SAS procedure."

 

Here is the comparison:

proc logistic data=sashelp.class outest=LogiPE;
model sex = height weight age;
run;

proc print data=LogiPE; run;

proc hplogistic data=sashelp.class outest;
ods output ParameterEstimates=HPLogiPE;
model sex = height weight age;
run;

proc print data=HPLogiPE; run;

Notice that if you want the HPLOGISTIC output to exactly match the LOGISTIC output, you can use PROC TRANSPOSE, as shown in the documentation:

 

proc transpose data=HPLogiPE out=inest(type=EST) label=_TYPE_;
   label Estimate=PARMS;
   var Estimate;
   id ParmName;
run;

proc print data=inest; run;

View solution in original post


All Replies
Grand Advisor
Posts: 16,893

Re: Can PROC HPLOGISTIC output Parameter Estimate to a SAS dataset

Yes, In fact it's the same name as proc logistic. 

HPLOGISTIC also has the OUTEST option. 

 

 

New Contributor
Posts: 3

Re: Can PROC HPLOGISTIC output Parameter Estimate to a SAS dataset

Hi Reeza,

While HPLOGISTIC also has OUTEST, it seems that the functionality is completely different. The OUTEST switch doesn't allow specification of a output estimate dataset. For example, the following code would fail:

 

PROC HPLOGISTIC DATA=&in_ds._binned_data OUTEST=parms;

TITLE &in_title;

CLASS &in_independent_class;

MODEL &in_dependent(DESCENDING)=

%DO j=1 %TO &in_num_cont;

var&j._miss_ind /* NOT Commented out for comparison */

%DO k=2 %TO &in_num_bins;

var&j._bin&k._ind

%END;

%END;

RUN;

 

Any suggestion?

Grand Advisor
Posts: 16,893

Re: Can PROC HPLOGISTIC output Parameter Estimate to a SAS dataset

Pretty sure you specify OUTEST in the HPLOGISTIC statement and capture the table using ODS output statement. 

Solution
Wednesday
SAS Super FREQ
Posts: 3,307

Re: Can PROC HPLOGISTIC output Parameter Estimate to a SAS dataset

It's always best to use one of the SASHELP sample data sets so that everyone can access the data and run the code.

You are correct: that the OUTEST option in HPLOGISTIC works differently than for PROC LOGISTIC. However, what Reeza is saying is that you can use the statement

ODS OUTPUT ParameterEstimates=HPLogiPE;

to convert the ParameterEstimates table to a SAS data set. See the article "ODS OUTPUT: Store any statistic created by any SAS procedure."

 

Here is the comparison:

proc logistic data=sashelp.class outest=LogiPE;
model sex = height weight age;
run;

proc print data=LogiPE; run;

proc hplogistic data=sashelp.class outest;
ods output ParameterEstimates=HPLogiPE;
model sex = height weight age;
run;

proc print data=HPLogiPE; run;

Notice that if you want the HPLOGISTIC output to exactly match the LOGISTIC output, you can use PROC TRANSPOSE, as shown in the documentation:

 

proc transpose data=HPLogiPE out=inest(type=EST) label=_TYPE_;
   label Estimate=PARMS;
   var Estimate;
   id ParmName;
run;

proc print data=inest; run;
New Contributor
Posts: 3

Re: Can PROC HPLOGISTIC output Parameter Estimate to a SAS dataset

[ Edited ]

Thank you! It worked beautifully!

Thanks also for telling me about the SASHELP library, I didn't previously know what is in it Smiley Happy

A follow-up question, does HPLOGISTIC has OUTMODEL or this can be implemented using ODS as well? Thanks!

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 84 views
  • 1 like
  • 3 in conversation