Desktop productivity for business analysts and programmers

Save Logistic regression results: question on by _impulation_;

Reply
New Contributor
Posts: 3

Save Logistic regression results: question on by _impulation_;

Hey SAS EG users,

I am new to SAS and my question is very basic and may have been asked before. I apologize for that and appreciate if you could point me the link to previous posts.

I try to save results from Logistic regression. I followed the Example 55.3, Reading Regression Results from a DATA= EST Data Set, from SAS 9.22 User Guide. But I met an error. Any suggestion are appreciated.

My code and data is as following:


data xx;

input y ex f;

cards;

0 0 45

0 1 5

1 0 10

1 1 40

;

proc logistic data=xx descending outest=outreg covout;

  class ex;

  model y = ex;

  freq  f;

  by _Imputation_;

run;

proc mianalyze data=outreg edf=98;

modeleffects intercept ex;

run;

And the error message in the log file as the following:

 

NOTE: PROCEDURE LOGISTIC used (Total process time):

      real time           0.01 seconds

      cpu time            0.00 seconds

    

ERROR: Variable _IMPUTATION_ not found.

NOTE: The SAS System stopped processing this step because of errors.

WARNING: The data set WORK.OUTREG may be incomplete.  When this step was stopped there were 0 observations and 0 variables.

WARNING: Data set WORK.OUTREG was not replaced because this step was stopped.

Super User
Posts: 11,101

Re: Save Logistic regression results: question on by _impulation_;

The example you are looking at used a data set named OUTMI created by PROC MI that added the varaible _IMPUTATION_. Your data set XX doesn't contain that variable so there is an error.

New Contributor
Posts: 3

Re: Save Logistic regression results: question on by _impulation_;

Thanks Ballaardw,

Back a few pages from the User`s guide, the example does use an imputed data.

Still, my questions remains-- how to save the estimates, odds, standard errors and P values to an external file? I use remote access so that I cannot see the regression result directly.

I have tried: outest=dataset but it only give me the estimates but not the rest.

Thank you very much for your time. Any suggestions are appreciated.

Community Manager
Posts: 2,882

Re: Save Logistic regression results: question on by _impulation_;

You can always use ODS Output to select the output tables as data sets.

Example:

ods output OddsRatios=OddsRatios;

proc logistic data=outmi outest=outreg covout ;

   model Oxygen= RunTime RunPulse;

   by _Imputation_;

run;

To see the available output tables produced by ODS, put ODS TRACE ON; ahead of your PROC LOGISITIC step.  The tables names will appear in the log:

Output Added:

-------------

Name:       OddsRatios

Label:      Odds Ratios

Template:   Stat.Logistic.OddsRatios

Path:       Logistic.ByGroup5.OddsRatios

-------------

Chris

New Contributor
Posts: 3

Re: Save Logistic regression results: question on by _impulation_;

Thanks Chris,

I have been testing ODS this morning and a small mysterious mistake takes me a lot of time, though I thought it should not be the problem.

The testing code is as following:

ods output "Parameter Estimates"=parest;

proc reg data=hsb25 noprint;

  model write = female math;

run;

quit;

ods output close;

proc print data=parest;

run;

With the NOPRINT option inside the PROC REG, any names other than PAREST will not generate the output data set.

Finally I found the following from SAS user guide :

"Many SAS procedures support a NOPRINT option that you can use when you want to create an output data set but without displaying any output....However, if you specify the NOPRINT option, the procedure might not send any output to ODS. In most procedures that support a NOPRINT option, NOPRINT means no ODS "

Ask a Question
Discussion stats
  • 4 replies
  • 459 views
  • 3 likes
  • 3 in conversation