Hello everyone, I'm newish to SAS, so please bare with me. I'm trying to create multiple flag variables based on the contents of a parsed out variable. My macro isn't doing what I want it to do... it's parameter is passing as a static string, rather than a dynamic variable. Any help would be greatly appreciated. ----------- Details! This is my input data: data Input;
input Variable_source $15.;
datalines;
01 03
01 03 04
01 05
01 02
; Here is my Macro code %macro parse (temp=);
data output; set Input;
%local i;
%do i = 1 %to %sysfunc(countw(&temp));
%let code = %scan(&temp, &i, %str( ));
VARIABLE_&code=1;
%end;
run;
%mend;
%parse (temp=Variable_source); It gives me this: Variable_source VARIABLE_variable_source 01 03 1 01 03 04 1 01 05 1 01 02 1 But I want this: Variable_source VARIABLE_01 VARIABLE_02 VARIABLE_03 VARIABLE_04 VARIABLE_05 01 03 1 1 01 03 04 1 1 1 01 05 1 1 01 02 1 1
... View more