Thanks all for the many replies. The reason I require the data to be separated is due to how it needs to be processed. The HIST data, as you might guess, is historical data. It needs to be added chronologically by period_date to an Oracle table. The existing macro for current data is as follows: %macro ImportData(dir2=); %let X = %sysfunc(fileexist(&dir2)); %put &X; %if &X = 0 %then %do; %put ERROR: File Missing. Contact Department; %goto exit; %end; %else %do; PROC IMPORT OUT = Employee DATAFILE = &dir2 DBMS = xlsx Replace; SHEET = "Test"; GETNAMES = YES; PROC SQL; DELETE FROM odbc AMM.AMM_Table; PROC SQL; INSERT INTO odbcAMM.AMM_Table (sasdatefmt = ( PERIOD_DT = 'MMDDYY10.', ACTION_DT = 'MMDDYY10.', EFFECTIVE_DT = 'MMDDYY10.', TERM_DT = 'MMDDYY10.', Load_DATE = 'MMDDYY10.' ) ) Select MANY VARIABLES..... FROM Employee; PROC SQL; connect to odbc(dsn = &dsnName); execute (call AMM.UPSERT_Table()) by odbc; %end; %exit: %mend; %ImportData(dir2= file location); Due to the logic in the call procedure [AMM.UPSERT_Table], I need to add the HIST data by period, chronologically. I won't go into the details of that but creating a macro to take the HIST data and loop through the period_dates so that I can fit it into the existing macro would save me a lot of time.That's my overall plan. If I can not figure out a way to do that I will parse out the data in the HIST table period_date by period_date and run it through this macro a section at a time. It's less elegant for sure, but would still achieve my objective.
... View more