I am trying to run a nonlinear regression model and want the regression parameter coefficient and statistical significance levels to be stored a SAS data file. I am using Proc Model for the estimation. When I use outest to output the estimates only (which just stores the coefficients, not the significance levels), it works perfectly.
proc model data= FUT2015.Initiate_Window2_1 plots= none noprint;
by symbl;
parms S alpha beta;
del_P = (S/2)*Qt + (alpha + beta - 1)*Q_t1 + alpha*(S/2)*(1-2*pi)*Q_t2;
fit del_P / outest = FUT2015.Reg_Results_Win1_2;
run;
When I try to use outparms to store the coefficients and the significance, the programme doesn't work.
proc model data= FUT2015.Initiate_Window2_1 outparms = FUT2015.Reg_Results_Win1_3 plots = none noprint;
by symbl;
parms S alpha beta;
del_P = (S/2)*Qt + (alpha + beta - 1)*Q_t1 + alpha*(S/2)*(1-2*pi)*Q_t2;
fit del_P;
run;
The programme doesn't throw up any errors, but just stops working after running the model for the last 'symbl'.
If I stop the programme forcefully at this step the log says
'Event Stack Underflow. This is probably caused by mis-matched begin and end event calls'
I am not sure what I am doing wrong. Can anyone help?
Seems strange. Please post your entire code including the ODS OUTPUT statement. This example from the PROC DOCUMENT documentation outputs the T-statistics, p-value and Standard Error when running
title 'Logistic Growth Curve Model of U.S. Population';
data uspop;
input pop :6.3 @@;
retain year 1780;
year=year+10;
label pop='U.S. Population in Millions';
datalines;
3929 5308 7239 9638 12866 17069 23191 31443 39818 50155
62947 75994 91972 105710 122775 131669 151325 179323 203211
226542 248710
;
ods trace on;
proc model data=uspop;
label a = 'Maximum Population'
b = 'Location Parameter'
c = 'Initial Growth Rate';
pop = a / ( 1 + exp( b - c * (year-1790) ) );
fit pop start=(a 1000 b 5.5 c .02);
ods output ParameterEstimates=ParamEst;
run;quit;
ods trace off;
proc print data=ParamEst;
run;
Try adding a quit statement after the run;
Thanks for the response.
I tried adding a quit statement as per your suggestion. Unfortunately, it doesn't work. Now the SAS output dataset contains just the coefficients (not the significance levels) for the last iteration or for the last 'symbl'.
Go for the ODS then. Add the statement:
ods output parameterestimates=pe;
to your code, before the run;
Unfortunately, even that exports only the parameter coefficients, not the statistics (e.g. - T-statistics, p-value, Standard Error). I am beginning to think that Proc Model does not allow for the statistics to be written to a data set.
Seems strange. Please post your entire code including the ODS OUTPUT statement. This example from the PROC DOCUMENT documentation outputs the T-statistics, p-value and Standard Error when running
title 'Logistic Growth Curve Model of U.S. Population';
data uspop;
input pop :6.3 @@;
retain year 1780;
year=year+10;
label pop='U.S. Population in Millions';
datalines;
3929 5308 7239 9638 12866 17069 23191 31443 39818 50155
62947 75994 91972 105710 122775 131669 151325 179323 203211
226542 248710
;
ods trace on;
proc model data=uspop;
label a = 'Maximum Population'
b = 'Location Parameter'
c = 'Initial Growth Rate';
pop = a / ( 1 + exp( b - c * (year-1790) ) );
fit pop start=(a 1000 b 5.5 c .02);
ods output ParameterEstimates=ParamEst;
run;quit;
ods trace off;
proc print data=ParamEst;
run;
I modified the same example as @PeterClemmensen to include BY processing and got all parameter estimates and statistics as expected. I'm using SAS 9.4 TS1M1.
Do you get the printed version of the parameter and statistics table?
Thanks a lot, it's working. I was initially using the ods output statement before proc model instead of before run within proc model.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.