turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- General Programming
- /
- proc model - start values

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-19-2014 02:18 AM

Hello, i have a problem with start values in the estimation of function in the proc model.

When i write specific initial values, the proc model works properly.

**example1:**

PROC model data=a Converge=0.01 SINGULAR=0.01 MAXSUBIT=30 ;

Rate=%function();

PARMS AlfaParam BetaParam GammaParam1 GammaParam2 DeltaParam1 DeltaParam2;

fit Rate start=(AlfaParam=300 BetaParam=-200 GammaParam1=500 GammaParam2=-200 DeltaParam1=1 DeltaParam2=3)

/ out=a_out itprint OUTPREDICT OUTEST=a_conv;

run;

quit;

But i use a macro, and i estimate a few curves and therefore i have to use for every curve his specific initial values,and i create them by call symputx.

**example2:**

%macro question;

data _NULL_;

merge Tbl_parms_prev blg_parparms_excel; /*import yesterday parms*/

by CurveId CurveType CurveSubType;

if CurveId=&CurveId and CurveType=&CurveType and CurveSubType=&CurveSubType;

call symputx('Alfa_start', round(AlfaParam,0.0001));

call symputx('Beta_start', round(BetaParam,0.0001));

call symputx('Gamma_start1',round(GammaParam1,0.0001));

call symputx('Delta_start1',round(DeltaParam1,0.0001));

call symputx('Gamma_start2',round(GammaParam2,0.0001));

call symputx('Delta_start2',round(DeltaParam2,0.0001));

run;

PROC model data=a MAXITER=100 Converge=0.01 SINGULAR=0.01 MAXSUBIT=30;

Rate=%function();

PARMS AlfaParam BetaParam GammaParam1 GammaParam2 DeltaParam1 DeltaParam2;

fit Rate start=(AlfaParam=&Alfa_start BetaParam=&Beta_start GammaParam1=&Gamma_start1 GammaParam2=&Gamma_start2 DeltaParam1=&Delta_start1 DeltaParam2=&Delta_start2)

/ out=a_out itprint OUTPREDICT OUTEST=a_conv;

run;

quit;

%mend question;

%question;

**Problem when i create start values through macro data step. the proc model doesn't converged, but when i write identical start values in directly, the proc model works perfectly. Maybe problem that after call symputx the macro variables is character number values.**

**Maybe somebody know what a solution to this problem?**

Thank you

Alexey

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Alexey

02-19-2014 03:34 PM

What does the log show when you run the macro with Options Mprint Symbolgen? Does the generated code look as expected?

There are a couple of possiblities if the generated code looks wrong. One might be to explicitly control the output of the rounded values in the Call Symputx statments. You currently are getting a likely default conversion from numeric to text using a Bestw. format which may be losing significant digits. I would try something like:

call symputx('Alfa_start',put( round(AlfaParam,0.0001),f12.5));

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to ballardw

02-20-2014 05:18 AM

Hello, i tried, but it doesn't help us.

this is log:

MLOGIC(CPI_BRANCHES_EVAL_P2): %PUT alfa_start_param=&alfa_start_param

SYMBOLGEN: Macro variable ALFA_START_PARAM resolves to 347

alfa_start_param=347

MLOGIC(CPI_BRANCHES_EVAL_P2): %PUT betta_start_param=&betta_start_param

SYMBOLGEN: Macro variable BETTA_START_PARAM resolves to -454

betta_start_param=-454

MLOGIC(CPI_EVAL_TWO_BOUNDS): Beginning execution.

SYMBOLGEN: Macro variable PARAMSNUM resolves to 2

MLOGIC(CPI_EVAL_TWO_BOUNDS): %IF condition &ParamsNum=2 is TRUE

MLOGIC(CPI_EVAL_TWO_BOUNDS): %PUT ParamsNum=&ParamsNum

SYMBOLGEN: Macro variable PARAMSNUM resolves to 2

ParamsNum=2

SYMBOLGEN: Macro variable LINKAGE resolves to cpi

SYMBOLGEN: Macro variable SECTION resolves to Other

SYMBOLGEN: Macro variable SCALE resolves to AAp

SYMBOLGEN: Macro variable MAXITER resolves to 100

SYMBOLGEN: Macro variable CONVERGE resolves to 0.000001

SYMBOLGEN: Macro variable SINGULAR resolves to 0.000001

SYMBOLGEN: Macro variable MAXSUBIT resolves to 30

MPRINT(CPI_EVAL_TWO_BOUNDS): PROC model data=curve_cpi_Other_AAp MAXITER=100

Converge=0.000001 SINGULAR=0.000001 MAXSUBIT=30 NOITPRINT;

SYMBOLGEN: Macro variable LINKAGE resolves to cpi

SYMBOLGEN: Macro variable SECTION resolves to Other

SYMBOLGEN: Macro variable LINKAGE resolves to cpi

MPRINT(CPI_EVAL_TWO_BOUNDS): cpi_Other_curve=

MLOGIC(NSS_CPI_EVAL): Beginning execution.

SYMBOLGEN: Macro variable DELTA1_GOV_CPI resolves to 1.1252459288

SYMBOLGEN: Macro variable DELTA1_GOV_CPI resolves to 1.1252459288

SYMBOLGEN: Macro variable GAMMA1_GOV_CPI resolves to 1667.927124

SYMBOLGEN: Macro variable DELTA1_GOV_CPI resolves to 1.1252459288

SYMBOLGEN: Macro variable DELTA1_GOV_CPI resolves to 1.1252459288

SYMBOLGEN: Macro variable DELTA1_GOV_CPI resolves to 1.1252459288

SYMBOLGEN: Macro variable GAMMA2_GOV_CPI resolves to -2361.17626953125

SYMBOLGEN: Macro variable DELTA2_GOV_CPI resolves to 1.3986303806

SYMBOLGEN: Macro variable DELTA2_GOV_CPI resolves to 1.3986303806

SYMBOLGEN: Macro variable DELTA2_GOV_CPI resolves to 1.3986303806

MPRINT(NSS_CPI_EVAL):

AlfaParam+BetaParam*((1-exp(-tm/1.1252459288))/(tm/1.1252459288))+1667.927124*(

(1-exp(-tm/1.1252459288))/(tm/1.1252459288)-exp(-tm/1.1252459288))+-2361.17626953125*((

1-exp(-tm/1.3986303806))/(tm/1.3986303806)-exp(-tm/1.3986303806))

MLOGIC(NSS_CPI_EVAL): Ending execution.

MPRINT(CPI_EVAL_TWO_BOUNDS): ;

MPRINT(CPI_EVAL_TWO_BOUNDS): PARMS AlfaParam BetaParam;

SYMBOLGEN: Macro variable ALFA_LOWER_BOUND resolves to 347

SYMBOLGEN: Macro variable ALFA_UPPER_BOUND resolves to 515

MPRINT(CPI_EVAL_TWO_BOUNDS): BOUNDS 347 <= AlfaParam <= 515 ;

SYMBOLGEN: Macro variable ALFA_BETTA_LOWER_BOUND resolves to -107

MPRINT(CPI_EVAL_TWO_BOUNDS): RESTRICT -107 <= AlfaParam+BetaParam ;

SYMBOLGEN: Macro variable ALFA_BETTA_UPPER_BOUND resolves to -107

MPRINT(CPI_EVAL_TWO_BOUNDS): RESTRICT AlfaParam+BetaParam <= -107 ;

SYMBOLGEN: Macro variable LINKAGE resolves to cpi

SYMBOLGEN: Macro variable SECTION resolves to Other

SYMBOLGEN: Macro variable ALFA_START_PARAM resolves to 347

SYMBOLGEN: Macro variable BETTA_START_PARAM resolves to -454

SYMBOLGEN: Macro variable LINKAGE resolves to cpi

SYMBOLGEN: Macro variable SECTION resolves to Other

SYMBOLGEN: Macro variable SCALE resolves to AAp

SYMBOLGEN: Macro variable LINKAGE resolves to cpi

SYMBOLGEN: Macro variable SECTION resolves to Other

SYMBOLGEN: Macro variable SCALE resolves to AAp

MPRINT(CPI_EVAL_TWO_BOUNDS): fit cpi_Other_curve start= (AlfaParam= 347 BetaParam= -454) /

out=cpi_Other_eval_out_AAp itprint OUTPREDICT OUTEST=cpi_Other_eval_conv_AAp;

MPRINT(CPI_EVAL_TWO_BOUNDS): run;

NOTE: The iteration limit is exceeded for OLS.

ERROR: The parameter estimates failed to converge for OLS after 100 iterations using CONVERGE=

1E-6 as the convergence criteria.

NOTE: The data set WORK.CPI_OTHER_EVAL_OUT_AAP has 100 observations and 5 variables.

NOTE: The data set WORK.CPI_OTHER_EVAL_CONV_AAP has 1 observations and 6 variables.

MPRINT(CPI_EVAL_TWO_BOUNDS): quit;

NOTE: PROCEDURE MODEL used (Total process time):

real time 0.34 seconds

cpu time 0.34 seconds

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Alexey

02-20-2014 12:12 PM

Your converge criteria is a lot tighter than in your example, 0.00001 vs 0.01. I would suggest either increasing the iterations or loosening the convergence criteria, maybe to 0.00001 or 0.0001.