I'll post a piece of the code just to get my point across. I have a dataset that has multiple VIOLATION variables in the form of VIOLATION1, VIOLATION2, and so forth, up to 10. I'd like to go through these variables and fill in "Name X", "Date X", "Incident X" by referencing the correct Violation X. But in the below example, &Incident_macro shows up as the text incident_counter, instead of showing up as 1 (or 2, or 3, or wherever it is in the loop). Does anyone know a way I could workaround this so the macro shows the numeric incident_counter, not the text? I should mention that the situation is a bit more complicated than this, which is why I can't just forgo the loop process and type out 1,2,3. Thanks for your help!!! incident_counter = 1;
%let incident_macro = incident_counter;
loop_counter = 0;
do while (loop_counter < 10);
if VIOLATION&incident_macro ne ' ' then do;
'Name &incident_macro'n = VIOLATION&incident_macro;
'Date &incident_macro'n = Date&incident_macro;
'Incident &incident_macro'n = incident_counter;
incident_counter = incident_counter + 1;
%let incident_macro = incident_counter;
end;
loop_counter = loop_counter + 1;
end;
... View more