BookmarkSubscribeRSS Feed
tschaukofall
Calcite | Level 5

Hello

I have a question regarding SAS’s PROC MODEL:

If I define a variables starting value for the iteration process, PROC MODEL uses it for the first observation of the processed dataset.

For the next observation it uses the final value of the previous iteration process to start the next iteration process.

In some cases this leads to trouble because the function I use has a singularity.

So how can I force proc model to use assigned starting values for the iteration process for every observation!

Thank you in advance.

Regards, Klaus

2 REPLIES 2
tschaukofall
Calcite | Level 5

Maybe some code can illustrate my problem:

The 2 input files differ in nothing but the sort order of the data.

In proc model initial values of the interation process are provided.

But after processing the first observation the procedure takes the final values

of the last iteration process as initial values of the next.

In some cases this works (See output of ascending.). In others it doesnt (Because of singularitys per instance).

So what i want to do is to provide initial values for variables at every observation.

data ascending;

      input @@ Total;

      cards;

      89 807

      ;

run;

data descending;

      input @@ Total;

      cards;

      807 89

      ;

run;

proc model noprint data=ascending;

      var fract_adsorbed 0.01 fract_balance 0.01;    

   eq.ISO=fract_adsorbed-((120*fract_balance*0.5)/(1+fract_balance*0.5));

   eq.REST=(fract_balance)-(Total-fract_adsorbed);

      solve fract_adsorbed fract_balance /itprint solveprint out=correct_result;         

run;quit;

proc model noprint data=descending;

      var fract_adsorbed 0.01 fract_balance 0.01;    

   eq.ISO=fract_adsorbed-((120*fract_balance*0.5)/(1+fract_balance*0.5));

   eq.REST=(fract_balance)-(Total-fract_adsorbed);

      solve fract_adsorbed fract_balance /itprint solveprint out=incorrect_result;       

run;quit;

tschaukofall
Calcite | Level 5

I think I solved the problem by adding the initial values of the variables to the input dataset..

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 Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 724 views
  • 0 likes
  • 1 in conversation