Greetings SAS experts,
I have a lot of statements that will vary that are structured like this:
if item = '0123' then e123 = data1; if item = '0541' then r541 = data2;
the variable item contains character values that are numbers.
I have a lot of lines like the above and I wanted to write a macro inside of a data step that allows me to do something like this
%macro ifcondition(newitem);
if item = '&newitem' then E&newitem = data1;
if item = '&newitem' then R&newitem = data2;
%mend;
%ifcondition(0123);
So I would like the numerous variants of this...
%ifcondition(0123);
to evaluate to this:
if item = '0123' then E0123 = data1; if item = '0123' then R0123 = data2;
What is the easiest way I can modify this so that this works correctly?
Thanks!!