EG 7.13 I want to generate a single data set from many. Each dataset has the same format, structure. To do this I envision a data statement that calls a macro which sets my data from a concatenated files list using a date range. Like this: /*CREATE FILE LIST*/
%MACRO file_part (startdate=, enddate=);
DATA file_list (DROP=date);
DO date= "&startdate"d TO"&enddate"d;
FORMAT date yymmddn8.;
file_part = cats("/mydir/",put(date,yymmddn8.),"_report");
OUTPUT;
END;
RUN;
%MEND;
/*Line of code for testing file_part as standalone*/
/*%FILE_PART(startdate=01Jan2019, enddate=1Oct2019);*/
/*GET MY DATA*/
DATA mydata;
SET %file_part(startdate=01Jan2019, enddate=10Oct2019);
RUN; ERROR: File WORK.DATA.DATA does not exist. ERROR: The variable date in the DROP, KEEP, or RENAME list has never been referenced. My research leads me to believe the DO statement in file_part is in correct, but I can't pintpoint why. How can I fix the code above to return the expected results (one dataset set from many)? Errors in code block.
... View more