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>;
ods output close;
ods listing;

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


May 30, 2006

SAS floating point exception error

Posted in SAS, SAS programming at 5:54 pm by Sneha

While using the high performance forecasting diagnose and engine(HPFDIAGNOSE and HPFENGINE) procedures in SAS/ETS, I have been bugged by this error for one full week.

ERROR: Domain error.
ERROR: Floating Point Exception.

I am a novice at SAS programming and unfortunately I couldn't find any online help regarding this. Anyway, somehow I have figured out one possible way that can fix this problem. Specifically in HPF diagnose, make sure that your history data has no "." in any of the observations for the dependent variable. Apparently, comparing a numeric value with a "." causes this problem.