I am trying to start the loop in %do expression to be equal to start_id =227
i use the % SYSEVALF(&start_id.) however, does not work
i want the proc hpbin to have in the WHERE statement the i which should take the values from start_id to end_id
%let start_id=227;
%let end_id=290;
%macro IV_continuous(ds=,vars=,bad=);
%let yy=%SYSEVALF((&end_id.-&start_id.)+1);
%do i=%SYSEVALF(&start_id.) %to &yy. ;
proc hpbin data = &ds. numbin = 10;
input &vars.;
where monthid = &i;
ods output mapping = bin_&i.;
run;
%end;
%mend;
%IV_continuous(ds=pd_data.upl_test,vars=&varcon,bad=bad);
Run this:
%let start_id=227;
%let end_id=290;
%let yy=%SYSEVALF((&end_id.-&start_id.)+1);
%put &=yy.;
Then manually insert the values into your %DO, and you'll see it resolves to this:
%do i = 227 %to 64;
which means the loop will never execute.
Either run it from &start_id to %end_id, or from 1 to &yy.
Run this:
%let start_id=227;
%let end_id=290;
%let yy=%SYSEVALF((&end_id.-&start_id.)+1);
%put &=yy.;
Then manually insert the values into your %DO, and you'll see it resolves to this:
%do i = 227 %to 64;
which means the loop will never execute.
Either run it from &start_id to %end_id, or from 1 to &yy.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.