Community - I am having difficulty troubleshooting an issue. I have two macros below. The second macro callbreak(), looks at a data set, and at each first.ID it calls the break macro. The break() macro creates a new data set selecting obs from the original data for that ID. So simply, it is creating a data set for each new unique ID. Break() then saves a macro description from a value in the data set so it can be used to name an Excel file. In the final step, the break() macro exports the new data set into Excel. The problem is, in the file path, &grpdesc. does not update. So all Excel reports have the same name and just overwrite one another. I was able to validate that the grpdesc macro is updating with each macro run. It just doesn't update in the file path. Any ideas? %macro break(byval, tblnm, report); data &report&byval; set &tblnm.(where=(uniqid= "&byval")); run; /*get group name for workbook*/ PROC SQL noprint; SELECT DISTINCT description into :grpdesc FROM &report&byval ; QUIT; PROC EXPORT DATA= &report&byval OUTFILE= "C:\Documents and Settings\mmangi01\Desktop\dump\&grpdesc. report.xlsx" DBMS=EXCEL REPLACE; SHEET=&report; RUN; %mend; %macro callbreak(tblnm, report); data _null_ ; set &tblnm.; by uniqid; if first.uniqid then call execute( '%break('||uniqid||', &tblnm, &report )' ); run; %mend callbreak; %callbreak(Be_pct2, be);
... View more