SAS - how to mask double quotes (for example, "")

I am running a VBA program from SAS. The SAS code for this basically looks like this:

%let worksheet =&i; *worksheet number; %let xlsfile = %STR(""C:\Data\Excel Workbook.xlsx""); %let csvfile = %STR(""C:\Data\CSV File..csv""); x 'cd "C:\Data\MN2013\Alignment\Data\SAS Programs"'; x "XlsWsToCsv.vbs &xlsfile &worksheet &csvfile"; 

I need to include two double quotes (i.e. "") at the beginning and end of the file paths in the xlsfile and csvfile file for the VBA program to recognize spaces in file paths and work correctly.

MY PROBLEM:

I run this in the SAS Enterprise Guide using SAS 9.3. In my journal, immediately after reading the variable definition, double quotes are underlined in red (usually indicate an error) with the number 49 below. There is no error message, but instead in green I get the following 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. 

For me, this says that SAS reads these double quotes. They are somehow partially masked. My VBA program works, so I can continue this; but I like clean error logs. Does anyone have any recommendations for fully masking the xlsfile and csvfile variables? I tried using% STR (as shown in my example above),% BQUOTE,% SUPERQ and some other things to make this work.

+4
source share
2 answers

These nasty error messages! You were very close, but try this syntax instead:

 %let xlsfile = %STR("")C:\Data\Excel Workbook.xlsx%STR(""); %let csvfile = %STR("")C:\Data\CSV File..csv%STR(""); 
+3
source

Double double quotes inside double quotes allow a single double quote character, i.e. ....

 x """c:\program files\office\excel.exe"" stuff stuff stuff ""stuff"" stuff"; 

should work fine. Don't worry about the 'identifier' message, which basically says something like

 "01JAN2013"d 

may be possible with other things. You can add a space after the last "if it is a problem, to have it in the log."

+2
source

Source: https://habr.com/ru/post/1489138/


All Articles