BookmarkSubscribeRSS Feed
DanielM
Calcite | Level 5
In proc NLmixed, I am attemping to run a loop that changes the starting parameter values. The do-loop will only allow me to step by integer values, but I need to step by values of 0.1. Here is what I have so far:

%macro iterate(i,j);
proc nlmixed data=dataset1;
parms beta1=&i,
beta2=&j,
s2e=1,
s2beta=1;

model Y ~ normal(beta1+beta2+betavar,s2e);
random betavar ~ normal(0,s2beta) subject=sid;
run;
%mend iterate;

%macro looped;
%do i=1 %to 2 %by 1;
%do j=1 %to 2 %by 1;
%iterate(&i,&j);
%end;
%end;
%mend looped;

%looped;
2 REPLIES 2
Russ_SAS
SAS Employee
We do not currently have a macro forum, the forum you have sent this question to is mainly for ODS, PRINT, REPORT and TABULATE.

A good place to send this type of question would be to support@sas.com

This will open a track for you with SAS Technical Support. This is very helpful when you have follow up questions as all the information is kept together within the tracking number given to you.

Here is a valuable link that discusses the different ways of contacting SAS Technical Support:

http://support.sas.com/techsup/contact/index.html

To answer your question, you are correct as the %DO handles whole integer numbers, but here is a link that points to an FAQ with a work-around:

http://support.sas.com/faq/036/FAQ03635.html

If you have any further questions regarding this issue please send e-mail to support@sas.com and we at SAS Technical Support will be happy to assist you.

Thanks,
Russ Tyndall
TobyDunn_hotmail_com
Fluorite | Level 6
Not the correct forum but shouldn't stop you from getting an answer.

%Macro NLLoop( StartI= , StopI= , ByI= ,
StartJ= , StopJ= , ByJ= ) ;

%Local I J MacIterI MaxIterJ ;

%Let MaxIterI = %SysEvalF( ( &StopI - &StartI ) / &ByI ) ;
%Let MaxIterJ = %SysEvalF( ( &StopJ - &StartJ ) / &ByJ ) ;

%Do I = 0 %To &MaxIterI ;
%Do J = 0 %To &MaxIterJ ;

Proc NLMixed
Data = &DataIn ;
Parms Beta1 = %SysEvalF( &StartI + ( &ByI * &I ) ) ,
Beta2 = %SysEvalF( &StartJ + ( &ByJ * &J ) ) ,
S2E = 1 ,
S2Beta = 1 ;
Model Y ~ Normal( Beta1 + Beta2 + BetaVar , S2E ) ;
Random BetaVar ~ Normal( 0 , S2Beta ) Subject = SID ;
Run ;

%End ;
%End ;

%Mend ;
%Mend NLLoop ;


%NLLoop( DataIn = DataSet1 ,
StartI = 1 , StopI = 2 , ByI = 0.1 ,
StartJ = 1 , StopJ = 2 , ByJ = 0.1 )

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1574 views
  • 0 likes
  • 3 in conversation