12-05-2017 09:09 AM
I would like (dummy example) to get the text 'hellobye' in a macro varaible. by running this code, the result in the log is
'hellobye GOPTIONS NOACCESSIBLE'. how to prevent the text "GOPTIONS NOACCESSIBLE" to be inserted ?
Thanks a lot in adance
%let text1 = hello ; %let text2 = bye ; %let text3 = %str(%')&text1.&text2.%str(%') ; %put &text3 ;
12-05-2017 09:28 AM
Its really not a good idea to put quotes of any kind in a macro variable, as you can tell just from the snippet you post it really makes coding and quoting so much harder and there is no reason for it.
%let text1 = hello ; %let text2 = bye ; %let text3 = &text1.&text2.; %put "&text3.";
12-05-2017 09:52 AM
thanks a lot RW9, but I need the ' to specify the file (with its folder) in ODS TAGSETS like this
ODS TAGSETS.EXCELXP FILE = "&file." ;
how could I obtain this
ODS TAGSETS.EXCELXP FILE = 'data/saswork/file_name.xml' ;
by loading the folder and the file in a macro variable ?
12-05-2017 09:58 AM
12-05-2017 10:03 AM
Your code would look like this:
%let fname=data/saswork/file_name.xml; ods tagsets.excelxp file="&fname.";
No need for any additional quotes.
12-05-2017 09:39 AM
Macro best practices aside...
If you are using SAS Enterprise Guide and you want to suppress this GOPTIONS statement, select the option from Tools->Options->Results, Graph panel:
12-05-2017 09:59 AM - edited 12-05-2017 10:00 AM
The problem is your use of quotes in macro variables, which is VERY BAD practice, as you just experience. It's just that additional code ends up in there, because SAS has problems finding the end of the string. This additional code is sent as "opening" and "closing" wrapper around your code by EG.
Now there are ways to make this work, but it's much easier to wrap quotes around text where they are needed, not where the text is defined.
%let text1 = hello ; %let text2 = bye ; data _null_; call symput('text3',"'&text1.&text2.'"); run; %put &text3 ;
12-05-2017 12:02 PM
by lauching your code , the result is 'hellobye GOPTIONS NOACCESSIBLE'
i succeed to prevent the GOPTIONS NOACCESSIBLE only by closing and restart sas EG.
thanks all for your help