BookmarkSubscribeRSS Feed
nzhou
Calcite | Level 5

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.

4 REPLIES 4
ballardw
Super User

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.

nzhou
Calcite | Level 5

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.

ChrisHemedinger
Community Manager

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

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
nzhou
Calcite | Level 5

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 "

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 4 replies
  • 2605 views
  • 3 likes
  • 3 in conversation