DATA Step, Macro, Functions and more

GOPTIONS NOACCESSIBLE appears inside variable text put in log

Reply
Frequent Contributor
Posts: 111

GOPTIONS NOACCESSIBLE appears inside variable text put in log

hello ,

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

regards

Nasser

%let text1 = hello ; 
%let text2 = bye ;
%let text3 = %str(%')&text1.&text2.%str(%') ;
%put &text3 ;

 

Super User
Super User
Posts: 9,193

Re: GOPTIONS NOACCESSIBLE appears inside variable text put in log

Posted in reply to Nasser_alfea

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.";
Frequent Contributor
Posts: 111

Re: GOPTIONS NOACCESSIBLE appears inside variable text put in log

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 ?

thanks

Super User
Posts: 9,551

Re: GOPTIONS NOACCESSIBLE appears inside variable text put in log

Posted in reply to Nasser_alfea

And where is the problem? You use double quotes when specifying the output file for ods, simple as that.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Super User
Super User
Posts: 9,193

Re: GOPTIONS NOACCESSIBLE appears inside variable text put in log

Posted in reply to Nasser_alfea

Your code would look like this:

%let fname=data/saswork/file_name.xml;

ods tagsets.excelxp file="&fname.";

No need for any additional quotes.

Community Manager
Posts: 3,349

Re: GOPTIONS NOACCESSIBLE appears inside variable text put in log

Posted in reply to Nasser_alfea

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:

 

suppress.png

Frequent Contributor
Posts: 111

Re: GOPTIONS NOACCESSIBLE appears inside variable text put in log

Posted in reply to ChrisHemedinger

Thanks Chris,

 

I have seleted this option but the problem remains

Super User
Posts: 9,551

Re: GOPTIONS NOACCESSIBLE appears inside variable text put in log

[ Edited ]
Posted in reply to Nasser_alfea

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.

EG

%let text1 = hello ; 
%let text2 = bye ;
data _null_;
call symput('text3',"'&text1.&text2.'");
run;

%put &text3 ; 

 

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Frequent Contributor
Posts: 111

Re: GOPTIONS NOACCESSIBLE appears inside variable text put in log

Posted in reply to KurtBremser

Kurt,

 

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

Ask a Question
Discussion stats
  • 8 replies
  • 208 views
  • 0 likes
  • 4 in conversation