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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.