I have a SAS macro where I would like to create a dataset name and then export that dataset to a csv file.
%macro export(outputDataset, prefix, outputFileName);
%let dName = cats(&prefix, test);
%let dName2 = cats(&prefix, test2);
data &outputDataset;
set &dName &dName2;
run;
proc export data=&outputDataset outfile="outputDir/&outputFileName" replace; run;
%mend export;
However, when I call the macro using
%export(retain, hh_dpt, retained.csv)
I get the following error:
ERROR: Invalid option name hh_dept.
Does anyone know what the problem could be? Thank you!