I have a strange problem with my SAS base ETL program. The program runs perfectly fine in the program editor of SAS base, but it aborts in batch mode. I'm currently debugging the entire code and I came at the following problem. I'm using an infile statement to read a txt file from a certain location.
When I run the program in the program editor mode, the infile statement runs perfectly and the dataset reads the right amount of data. But when the program runs in the batch mode, it seems like the infile statement is completely ignored. The datasets reads nothing and remains empty with 0 observations.
Here is the code with the log:
DATA odd.mailables_&monthcode.;
length id_account 8
language_id $2
zip $4;
infile &file_name. delimiter='09'x firstobs=2 dsd pad missover end=last;
load_date_time=datetime();
if _n_=1 then
do;
call symputx ('start_load_date_time', load_date_time);
end;
format load_date_time datetime20.;
monthcode="&monthcode.";
input id_account
language_id $
zip $;
if last then
do;
call symputx ('end_load_date_time', load_date_time);
end;
RUN;
proc sort data=odd.mailables_&monthcode.;
by id_account;
run;
This is the log afterwards:
SYMBOLGEN: Macro variable FILE_NAME resolves to "D:\mailables.txt"
"D:\mailables.txt"
SYMBOLGEN: Macro variable MONTHCODE resolves to 20150506
SYMBOLGEN: Macro variable FILE_NAME resolves to "D:\mailables.txt"
SYMBOLGEN: Macro variable MONTHCODE resolves to 20150506
NOTE: The data set ODD.MAILABLES_20150506 has 0 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
Memory 141k
OS Memory 7864k
Timestamp 8/05/2015 14:32:50
SYMBOLGEN: Macro variable MONTHCODE resolves to 20150506
NOTE: PROCEDURE SORT used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
Memory 33k
OS Memory 7864k
Timestamp 8/05/2015 14:32:50
Is there a difference between the batch mode and the program editor mode in the way it reads the code or in the syntax you need to use?
Thanks for the information