BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ericdrosano
Obsidian | Level 7

I am borrowing from the code on THIS sas help page. I am attempting to output the parameter estimates from a proc reg, but without printing the results. The code from the SAS help page is as follows:

   ods output ParameterEstimates = parms;
   proc reg data=sashelp.baseball;
      model logsalary = nHits nBB YrMajor / clb;
      quit;
   proc print data=parms noobs;
      run;

This copies the parameter estimate data to the 'parms' dataset, like I want to do with my own dataset; however, if I tell it to not print, like below, it will not output the parameter estimates. It even says exactly this in the warning.

 

So, is there a way to get those estimates into a dataset without having to print it? I have some datasets that are you using hundreds of variables, so I don't want to have to go through printing just to get those results.

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

@ericdrosano wrote:

 

however, if I tell it to not print, like below, it will not output the parameter estimates. It even says exactly this in the warning.


How are you telling SAS to not print? Do you mean you are using the NOPRINT option in PROC REG? If so, that's what is supposed to happen.

 

If you want the data set only, with nothing printed, turn off the output via ODS.

 

ods exclude all;
ods output ParameterEstimates = parms;
proc reg data=sashelp.baseball;
      model logsalary = nHits nBB YrMajor / clb;
quit;

 

You might want to undo the ODS command later to allow output, this would be

ods include all;

 

More info at: https://blogs.sas.com/content/iml/2015/05/26/suppress-ods.html

 

--
Paige Miller

View solution in original post

3 REPLIES 3
PaigeMiller
Diamond | Level 26

@ericdrosano wrote:

 

however, if I tell it to not print, like below, it will not output the parameter estimates. It even says exactly this in the warning.


How are you telling SAS to not print? Do you mean you are using the NOPRINT option in PROC REG? If so, that's what is supposed to happen.

 

If you want the data set only, with nothing printed, turn off the output via ODS.

 

ods exclude all;
ods output ParameterEstimates = parms;
proc reg data=sashelp.baseball;
      model logsalary = nHits nBB YrMajor / clb;
quit;

 

You might want to undo the ODS command later to allow output, this would be

ods include all;

 

More info at: https://blogs.sas.com/content/iml/2015/05/26/suppress-ods.html

 

--
Paige Miller
ericdrosano
Obsidian | Level 7

One fix though. Were you say to, undo the ods exclude all with: 

 

ods include all;

seems to be incorrect. I've looked up the fix, and I think it should instead be:

 

 

ods exclude none;

Notwithstanding, your solution was still timely and helpful!

 

ericdrosano
Obsidian | Level 7

That worked like a charm!

It seems that whenever I was running the previous commands on my data, it was overwhelming SAS on my computer. So, I was needing a way around the printing, and your solution was a dandy. Thank you very much!

😁

Also, yes, I was popping noprint right after proc reg, which, as expected, was killing the printing and the output.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 3 replies
  • 1089 views
  • 5 likes
  • 2 in conversation