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

whoops. that's because I forgot to put a do loop in .  try this

%macro rtm (j=31) ; 

%do i = 1 %to &j ; 

proc nlp noprint data=S&i absgconv=1e-15 OUTEST=T1; by obs;
bounds R>=0, R<=1;
min f;
decvar R=1;
f = abs(PRC1_IBES-(BVPS1_1+(((FEPS1_1/BVPS1_1_1)-R)/(1+R))*BVPS1_1
+(((FEPS2_1/BVPS2_1_1)-R)/((1+R)**2))*BVPS1_1_1
+(((FEPS3_1/BVPS3_1_1)-R)/((1+R)**3))*BVPS2_1_1
+(((FEPS4_1/BVPS4_1_1)-R)/((1+R)**4))*BVPS3_1_1
+(((FEPS5_1/BVPS5_1_1)-R)/((1+R)**5))*BVPS4_1_1
+(((FEPS6_1/BVPS6_1_1)-R)/((1+R)**6))*BVPS5_1_1
+(((FEPS7_1/BVPS7_1_1)-R)/((1+R)**7))*BVPS6_1_1
+(((FEPS8_1/BVPS8_1_1)-R)/((1+R)**8))*BVPS7_1_1
+(((FEPS9_1/BVPS9_1_1)-R)/((1+R)**9))*BVPS8_1_1
+(((FEPS10_1/BVPS10_1_1)-R)/((1+R)**10))*BVPS9_1_1
+(((FEPS11_1/BVPS11_1_1)-R)/((1+R)**11))*BVPS10_1_1
+(((FEPS12_1/BVPS12_1_1)-R)/(R*(1+R)**11))*BVPS11_1_1));
run;
data T1; set T1;
if _TYPE_='PARMS';
rename R=rgls1_1_1;
keep obs R; run;
data O&i; merge S&i (in=xx) T1(in=yy); by obs; if xx and yy; run;
%end; %mend rtm; %rtm(j=31);

 

nazmul
Quartz | Level 8

Thank you very much. Your solution works perfectly. I am sorry I do not have the option to choose two right answers here. Otherwise, I would select your one too.

nazmul
Quartz | Level 8
Thank you for your valuable time and help.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 17 replies
  • 3473 views
  • 2 likes
  • 3 in conversation