10-31-2017 10:03 AM
I have a variable with a single quote and ampersand that is being invoked when I don't want it to.
In this data step, I am trying to create a variable with a single quote and Ampersand, but I'm getting the error that macro variable W is not resolved. What function can I use to fix this?
Retain Supplier Alignment_Geo Alignment_Name Market Region BU;
set SC_ZIP (keep=IMS_ZIP Market Region BU rename=(IMS_ZIP=Alignment_Geo));
In the following Proc Export, I am trying to use the same name in the outfile name, but also need to be able to invoke the macro for yyyymm and yyyymmdd. How can I fix this?
proc export data=SC_Mkt
outfile="C:\Alignment\&yyyymm Paul's\Upload to RxI\Paul's H&W &yyyymmdd..csv"
10-31-2017 10:09 AM - edited 10-31-2017 10:10 AM
outfile="C:\Alignment\&yyyymm Paul%str(%')s\Upload to RxI\Paul%str(%')s %nrstr(H&W) &yyyymmdd..csv"
10-31-2017 10:12 AM
10-31-2017 10:13 AM
It is very bad juju to have special characters in directory paths like ',?! and such.
However if you want SAS to resolve to a single quote you can place two single quotes in the text when using a single quote to prevent macro resolution:
But for that path I would strongly suggest not to use any ' or & in the path names. Or at least very carefully evaluate the business logic for having such things.
10-31-2017 10:35 AM
See Maxim 44. What's said there about blanks goes double for any special characters.
Use a LART on the one who came up with those crazy file- and pathnames.