BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
alepage
Barite | Level 11

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?

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
yabwon
Onyx | Level 15

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 

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



View solution in original post

3 REPLIES 3
yabwon
Onyx | Level 15

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 

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



Quentin
Super User

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.

The Boston Area SAS Users Group (BASUG) is hosting our in person SAS Blowout on Oct 18!
This full-day event in Cambridge, Mass features four presenters from SAS, presenting on a range of SAS 9 programming topics. Pre-registration by Oct 15 is required.
Full details and registration info at https://www.basug.org/events.
Tom
Super User Tom
Super User

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;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

SAS Enterprise Guide vs. SAS Studio

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 533 views
  • 2 likes
  • 4 in conversation