DATA Step, Macro, Functions and more

Double Double Quoting on SYSTASK command

Reply
Super Contributor
Posts: 319

Double Double Quoting on SYSTASK command

 

Hi,

 

This is in reference to my previous question which has been resolved to use systask to execute a python script

 

https://communities.sas.com/t5/Base-SAS-Programming/Quoting-on-SYSTASK-command/m-p/340337#M77770

 

 

%let command = activate &python_env %nrstr(&&) python %nrquote(""%trim(&python_script_path)\load_data.py"") %nrquote(""%trim(&source)"") %nrquote(""%trim(&target)"")  2> %nrquote(""&logfile..log"");

systask command "&command" wait status=taskrc;

 

 

While the double double quote is able to successfully execute the python script, I get this note:

 

NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a quoted string and the succeeding identifier is recommended.

49: LINE and COLUMN cannot be determined.

 

Data is loaded successfully but I get an error due to this problem. Strange that the SAS log says that this is an error when it's a note.

 

Any help or enlightenment would be greatly appreciated. Thank you!

 

Thanks!

 

 

Trusted Advisor
Posts: 1,397

Re: Double Double Quoting on SYSTASK command

I know this note for a long time and ignored it without any issues.

Anyway, if you need double-double-quotes, do not insert a blank between them.

 

What kind of error you got? Is there another message?

A note may result in return-code 4 instead 0.

That may be resolved as "error" in unix/linux script running.

Super User
Super User
Posts: 7,413

Re: Double Double Quoting on SYSTASK command

Not really on topic, but would:

data _null_;
  command=catx(' ',"activate &python_env.",'&&',quote("&python_script_Path.\load_data.py"),quote("&source."),quote("&target."),'2>',quote("&logfile.")); 
  call execute(cat('systask ',command,' wait status=taskrc;'));
run; 

Not be simpler?

Super Contributor
Posts: 319

Re: Double Double Quoting on SYSTASK command

This partially solved my problem totally not off topic and thanks for the suggestion.

 

As a workaround I had to put the resolving command to a batch file and let systask execute it. 

 

data _null_;
	file "&path.\&job..bat";
	length command $ 1000;
	command=<catx portion>; 
	put command;
run; 

/* execute generated batch job script */
systask command "&path.\&job..bat" wait taskname=&taskname status=taskrc;

 

 

Super User
Posts: 5,086

Re: Double Double Quoting on SYSTASK command

Worth a try, that's the only way to tell:  Inside a quoting function, some characters (quotes included) can be preceded by a %.  Wherever you have:

 

""

 

Try replacing it with:

 

%"%"

Super User
Posts: 10,526

Re: Double Double Quoting on SYSTASK command


milts wrote:

 

NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a quoted string and the succeeding identifier is recommended.

 

 

Data is loaded successfully but I get an error due to this problem. Strange that the SAS log says that this is an error when it's a note.

 


Be very aware that was not an error is is a NOTE.

Currently SAS uses three constructs with a quote followed by a character that I am aware of currently for date, time and datetime literals such as '01JAN2017'D or "12:15:23"t. The note is warning that at some unspecified time in the future the specific string that you are creating with a  value like 'sometext'q might start being interpretted in a different fashion if SAS adds a new data literal or implied function or whatever. So they are suggesting that it might be a good idea to use 'sometext' q instead (with a space before the q)

Valued Guide
Posts: 797

Re: Double Double Quoting on SYSTASK command

This is all conjecture, but I'd be interested if my suggestion at the end works.

 

I believe this note came in about the time that name literals (e.g. allowing  'gdp_growth%'n and "gdp_growthpct"n as valid varnames) were introduced.

 

I guess this is because SAS wanted to reserve the possibility of adding other types of "quote-literals" to the current set (i.e. '01jan1060'd for dates, '12:00:00't for times, '01jan1960:08:45'dt for datetimes, and 'xxx'n for names).

 

Did you try the suggestion in the note, i.e. following the double-double quotes with a blank (possibly only the "closing" double-double quotes need to be followed by a blank).

Ask a Question
Discussion stats
  • 6 replies
  • 134 views
  • 2 likes
  • 6 in conversation