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

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?

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

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;

  

View solution in original post

7 REPLIES 7
PGStats
Opal | Level 21

Try adding a quit statement after the run;

PG
Anirban
Obsidian | Level 7

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'.

PGStats
Opal | Level 21

Go for the ODS then. Add the statement:

 

ods output parameterestimates=pe;

 

to your code, before the run;

PG
Anirban
Obsidian | Level 7

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.

PeterClemmensen
Tourmaline | Level 20

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;

  

PGStats
Opal | Level 21

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?

PG
Anirban
Obsidian | Level 7

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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is ANOVA?

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.

Discussion stats
  • 7 replies
  • 2503 views
  • 0 likes
  • 3 in conversation