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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—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.