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.
@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
@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
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!
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.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.