Since the the length of the value of a macro variable cannot exceed the maximum length of (65534), I can't create a single macro variable for all of my observations. I would like to create a macro to iterate through my data set to generate several numeric lists that I can pass to a where statement in proc sql.
Instead of this:
*proc sql noprint;
select ID into :ParaList separated by ','
from work.ID_LIST(**firstobs=1 obs=5000**);
quit;*
*proc sql noprint;
select ID into :ParaList2 separated by ','
from work.ID_LIST(**firstobs=5001 obs=10000**);
quit;*
*proc sql noprint;
select ID into :ParaList3 separated by ','
from work.ID_LIST(**firstobs=10001 obs=15000**);
quit;*
*proc sql noprint;
select ID into :ParaList4 separated by ','
from work.ID_LIST(**firstobs=15001 obs=20000**);
quit;*
I'd like something like:
*proc sql noprint;
select ID into :List1-Last4 separated by ','
from work.ID_LIST(**firstobs=1 obs=&LASTOBS** BY 5000);
quit;*
I'd like to create a macro to loop through every 5000 observations or so until last observation that I can pass into a where statement such as where id in (&ParaList,&ParaList2,&ParaList3,&ParaList4). I know there are alternatives such as
id in (select id from work.table)
but in this case, it doesn't work. I am querying Hadoop through SAS and haven't had any success except passing macro variable lists.
%ds2list
macro in this answer: stackoverflow.com/questions/49899251/… . It will stream the list as output so it doesn't suffer from the same limitations of a macro variable. – Robert Penridgeid in (select id from work.table)
can you use theSASTRACE
options to log what lower level activity the SAS/Access library engine is doing ? – Richard