BookmarkSubscribeRSS Feed
Aditi24
Obsidian | Level 7

Hi,

 

I have SAS 9.1.3 , 9.3 and 9.4(all three of them) installed on my Unix server. So I have an application which is used to submit batch programs to the remote SAS. Also, I can signon to any of the three versions and submit a batch to any of the three SAS version on the same UNIX server. To choose the version I want to sumbit my batch on, I have given a radiobox control which has which has 3 radio buttons(See attached).

 

To get the above submission, I am using the following code:-

 

 

/* macro "sysver" gives the version of SAS currently connected to and sasver refers to the server I 
want to submit batch on, based on which certain flags are getting modified*/ %if "&sysver"="9.1" and "&sasver"="sas93" or "&sasver"="sas94" %then %let flag_reset=1; %else %if "&sysver"="9.3" or "&sysver"="9.4" and "&sasver"="sas" %then %let flag_reset=2; %else %let flag_reset=0; /* To submit batch from a lower version to higher, I am including TKPATH variable and assigning
it an empty string which will be later set to the tkpath*/ %if &flag_reset=1 %then %do; %let tkpath=%sysget(TKPATH) ; options set=TKPATH "" ; %end;

So when I am signed on to SAS 9.3 or 9.4,I am getting a warning message as below:-

 

 

WARNING: The argument to macro function %SYSGET is not defined as a system variable.

Even if the statment (below) is inside a conditional construct which is never getting executed, it is prompting me the above warning message.

%let tkpath=%sysget(TKPATH) ;

 

Please suggest a method to either remediate this or get rid of the warning message.


Capture.PNG
9 REPLIES 9
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Macro language is a code generation system.  It is always run, and always decomipled.  Basically the preprocessor is trying to sort out all the references before trying conditionals.  I would ask why your trying to do things this way.  Every version of SAS can have its own confirguration setup - autoexec.sas - which gets called when the SAS system starts up - in batch that can be in the same folder as the program, or on the install area.  This kind of setup code would be far better suited to be put in the setup autoexec.sas file for the individual installs, then you don't need to worry about all the code below or try to replicate what that is doing, you just add the necessary code into each autoexec.sas.

Aditi24
Obsidian | Level 7
@RW9: Thanks for getting a clear understanding of the issue I am stuck with but could you please elaborate on how and what to put in the autoexec.sas file. I am a noob in this area. Your suggestions will be very helpful 🙂
RW9
Diamond | Level 26 RW9
Diamond | Level 26

This depends on your setup/install.  You would need to check with your IT group where/how they have set it up.  Its called autoexec.sas, and if you run something in batch (if installed locally) then the autoexec can reside in the same directory, or it could be on the network drive that SAS is installed on.  Speak to whoever installed it, they should be able to show you where the install is and then you will see this file.

Kurt_Bremser
Super User

autoexec.sas is a simple text file containing Base SAS code. So everything that works in a code window in EG or SAS Studio will work there.

Code that needs to be done anytime a SAS session or batch job is started, should go in there.

Depending on your setup, you can either use a (or the) global autoexec.sas, or you might be better off modifying a autoexec_usermods.sas file in your configuration path on the server.

 

Aditi24
Obsidian | Level 7
Thank you so much @RW9, @Kurt_Bremser. That makes it more clear.
Kurt_Bremser
Super User

I also suspect you have a typo in there, as &sasver is not a defined automatic macro variable.

Which makes me question the purpose of

%if "&sysver"="9.1" and "&sasver"="sas93" or "&sasver"="sas94"

 

FreelanceReinh
Jade | Level 19

On my Windows machine, I cannot replicate the warning message if the %LET statement using the %SYSGET function is not executed (because the %IF condition is not met). I conclude, that it is executed in your case when you receive the warning message.

 

As the reason I suspect incorrect logic: Please note that your condition

"&sysver"="9.1" and "&sasver"="sas93" or "&sasver"="sas94"  

could be rewritten as

("&sysver"="9.1" and "&sasver"="sas93") or "&sasver"="sas94"

but it seems more plausible to me that it should read

"&sysver"="9.1" and ("&sasver"="sas93" or "&sasver"="sas94")

And similarly for the other condition

"&sysver"="9.3" or "&sysver"="9.4" and "&sasver"="sas"

So, I would try to insert parentheses at the appropriate places.

Aditi24
Obsidian | Level 7

Thank you so much..that was a very silly error which was overlooked.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 9 replies
  • 3005 views
  • 1 like
  • 4 in conversation