Hi, I have a rather simple macro that I am using to run a proc sql. I am not able to resolve the error. Any help would be appreciated. %macro _countrec_updatetaxid(taxid); proc sql; create table work.extract as ( select count(*) :into rec_cnt from &FLDR..&FLDR._mcid_etg where etg1tax contains ('&taxid') ); QUIT; %mend _countrec_updatetaxid; *%local taxid rc; %let taxid=43612589; %let rc=%_countrec_updatetaxid(&taxid); %put "The number of records for tax id is" &rc; The error is NOTE: Line generated by the invoked macro "_COUNTREC_UPDATETAXID". 29 proc sql; create table work.extract as ( select count(*) :into rec_cnt from &FLDR..&FLDR._mcid_etg where etg1tax ______ 180 29 ! contains ('&taxid') ); QUIT; ERROR 180-322: Statement is not valid or it is used out of proper order. I think the bug is small but I am not able to notice what is wrong with the code. Thanks, saspert. PS: The bigger plan is to invoke the above macro for all the records of a dataset using call execute statement. That is why I am testing this macro first. Message was edited by: saspert So here is the crux of my issue. I have a main sas dataset &FLDR..&FLDR._mcid_etg with several hundreds of taxids. Some of them (around 83 distinct taxids) have a missing leading 0 for them. Now, I have all 83 of them in a separate dataset called work.msng_taxid. So, I need to somehow do this repetitive task of fetching 1 taxid, counting the # of records in &FLDR..&FLDR._mcid_etg and updating it with the correct taxid. In the above example, 43612589 needs to be replaced with 043612589.
... View more