May 31, 2006

Saving PROC REG output in SAS dataset

Posted in SAS, SAS programming at 1:15 pm by Sneha

PROC REG does not provide an option of saving F statistics and p-values in an output data set. Although in real life, we often encounter scenarios where we need to do so. For example, we might want to perform some action only if a particular independent variable is turning out to be significant. Manual processing becomes impossible when you have hundreds of regression models being run.

The output delivery system(ODS) in SAS provides great flexibility in handling output. Here’s the code to save the p values produced by PROC REG into a SAS dataset.

ods listing close;
ods output "Parameter Estimates"=<output dataset name>;
proc reg data=<input dataset name>;
model <dependent var> = <independent variables>;
run;
quit;
ods output close;
ods listing;

Just make sure you dont specify the NOPRINT option in PROC REG as the ODS needs an output object.

9 Comments »

  1. Anonymous said,

    Google

    Google news and reviews

  2. damn all these beautiful gir. Corrina Eudora.

  3. they’ll have you suicidal suicida. Liesbeth Kiki.

  4. Idetrorce said,

    very interesting, but I don’t agree with you
    Idetrorce

  5. apurv said,

    Thank you for posting this. It saved me time and having to write a macro!

  6. Gab said,

    Thanks, very usefull

  7. sotoDyptomi said,

    I am often searching for new infos in the world wide web about this topic. Thankz.

  8. Liping said,

    Hi! I’ve been searching for the solution since two weeks (I also need to create a table just containing the p-values of the variables) and I’ve found your article today! Thank you so much! It does work! Fantastic! :D

  9. sunnynil said,

    Thank you! This helps a lot


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.