2

I am trying to carry out a logistic regression with SAS. I have few settings for the model, and try to compare the difference.

What I want to archieve is to output the estimated coefficients to a file. I think ODS maybe a promising way, but don't know how to use it.

Can anyone write me a simple example?

Thank you very much.

ChangeMyName
  • 7,018
  • 14
  • 56
  • 93

3 Answers3

3

For Logistic:

proc logistic data = in descending outest = out;
  class rank / param=ref ;
  model admit = gre gpa rank;
run;

For proc reg:

proc reg data=a;
   model y z=x1 x2;
   output out=b
run;

for proc glm:

ods output Solution=parameters FitStatistics=fit;
proc glm data=hers;
model glucose = exercise ;
quit;
run;
scott
  • 2,235
  • 1
  • 14
  • 18
3

To add a bit of additional color; ODS OUTPUT <NAME>=DATASET ... ; will save the output into the specified dataset.

Use ODS TRACE get the names of output tables. Information on the tables will be written to the log.

ods trace on;
ods output ParameterEstimates=estimates;
proc logistic data=test;
model y = i;
run;
ods trace off;
DomPazz
  • 12,415
  • 17
  • 23
  • Hi, DomPazz. Thanks for the answer. I think it works. I've also tried to commet out the trace statements, and it works all the same. Can you explain the effect of `trace on` and `trace off` please? Thank you very much. :) – ChangeMyName Nov 18 '13 at 15:00
  • Sure, `ODS TRACE ON;` tells the ODS system to echo to the log each output table that it delivers (ie prints to your output). `ODS TRACE OFF;` turns off the echo to the log. – DomPazz Nov 18 '13 at 15:11
1

for proc reg this doesn't work for me

Use proc reg OUTEST=b

proc reg data=a outest=b;
  model y=x1;
run;

other reg can get other parameters added to OUTEST.

Paul Davis
  • 11
  • 1