I have a list of IDs that contain multiple "XO codes". I want to create a macro that will loop through these IDs and create a table for each using a where statement that corresponds to the appropriate XO code. EX:
%let ID_77= '35X02','35X04';
%let DnO_IDs= &ID_77; /intends to add more &ID_ numbers/
%macro loop;
proc sql;
%do k=1 %to %sysfunc(countw(&DnO_IDs_Ids.));
%let ID= %scan(&DnO_IDs.,&k.);
create table EP_&ID as
select * from table
where XO in ("&ID.") and AY>=(&CurrY-14);
%end;
quit;
%mend;
%loop;
I am receiving this error: ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: '35X04' ERROR: Argument 2 to macro function %SCAN is not a number. ERROR: The macro LOOP will stop executing.
EP_'35X02'
. You should either remove the quotes from the original list or remove them from the newID
macro variable. – Tom&DnO_IDs_Ids.
doing? That's an extra&ids
compared to what you have in your%let
statement. – Joe