Hello,
The %tslit function is working properly using SAS EG either when we use the development server or the production server. But when comes the time to use that piece of code below, I am getting this error:
MPRINT(TXNCNCTIMPTFRMORA): filename jsonf "/dwh_actuariat/sasdata/current/OneCx_Qualitrics/BOnline_S2023032912000000.json";
MPRINT(TXNCNCTIMPTFRMORA): data _null_;
MPRINT(TXNCNCTIMPTFRMORA): infile dest1 end=eof;
22: LINE and COLUMN cannot be determined.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred.
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, arrayname, #, (, +, /, //, ;, @, @@,
OVERPRINT, _ALL_, _BLANKPAGE_, _ODS_, _PAGE_.
200: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred.
ERROR 200-322: The symbol is not recognized and will be ignored.
MPRINT(TXNCNCTIMPTFRMORA): file jsonf;
WARNING: Apparent invocation of macro TSLIT not resolved.
MPRINT(TXNCNCTIMPTFRMORA): if _n_=1 then put %tslit({"contacts":);
MPRINT(TXNCNCTIMPTFRMORA): input;
MPRINT(TXNCNCTIMPTFRMORA): put _infile_;
MPRINT(TXNCNCTIMPTFRMORA): if eof then put '}';
MPRINT(TXNCNCTIMPTFRMORA): run;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
The code:
/* Making a copy of the json file on the server */
filename &dest. %sysfunc(quote(%sysfunc(pathname(&dest.))/&JsonFName&orderdate.&ordertime..json));
data _null_;
infile dest1 end=eof;
file &dest.;
if _n_=1 then put %tslit({"transactionMeta":{"batchId":"&batchid."%str(,) "fields":[&vars.]}%str(,)"contacts":[);
input;
put _infile_;
if eof then put ']}';
run;
Any suggestion or work aroung solution?
Probably path with %Tslit() for sasautos is not added to the session setup.
Try not using %tslit(), for example:
data _null_;
infile dest1 end=eof;
file &dest.;
if _n_=1 then
do;
length header $ 1024;
header = cats(
'{"transactionMeta":{"batchId":"',symget("batchid"),'"%str, "fields":[',symget("vars"),']},"contacts":['
);
put header;
end;
input;
put _infile_;
if eof then put ']}';
run;
Bart
Probably path with %Tslit() for sasautos is not added to the session setup.
Try not using %tslit(), for example:
data _null_;
infile dest1 end=eof;
file &dest.;
if _n_=1 then
do;
length header $ 1024;
header = cats(
'{"transactionMeta":{"batchId":"',symget("batchid"),'"%str, "fields":[',symget("vars"),']},"contacts":['
);
put header;
end;
input;
put _infile_;
if eof then put ']}';
run;
Bart
Are you sure that whole error is coming just from the unresolved macro reference?
I agree with Bart, it's probably a problem with the autocall library set up.
But I would check by running a simple test:
%put %tslit(foo) ;
Just to make sure the problem isn't somewhere else in the macro TXNCNCTIMPTFRMORA.
No need for the macro %TSLIT() you can just call the actual QUOTE() and tell it to use single quotes.
%put %tslit(xyz);
%put %sysfunc(quote(xyz,%str(%')));
But since the goal is just to write to a text file why bother with any macro logic? The PUT statement should be able to handle what you want to do.
/* Making a copy of the json file on the server */
filename &dest. %sysfunc(quote(%sysfunc(pathname(&dest.))/&JsonFName&orderdate.&ordertime..json));
data _null_;
infile dest1 end=eof;
file &dest.;
if _n_=1 then put '{"transactionMeta":{"batchId":"' "&batchid." '", "fields":[' "&vars." ']},"contacts":[';
input;
put _infile_;
if eof then put ']}';
run;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.