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

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
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 "

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1832 views
  • 3 likes
  • 3 in conversation