DATA Step, Macro, Functions and more

User macros not getting loaded at start up

Reply
Contributor
Posts: 20

User macros not getting loaded at start up

HI

 

I have a directory set up that contains user macros. I set this directory in my apperver_autoexe_usermods.sas file so it should be initialised at start up. However when I am working in Enterprise Guide I cannot call the marocs as the don't seem to have been loaded.

If I manually execute a macro I can then use it in my programs so it does not seem to be an issue with the code more a configuration issue.

Is there anything else that I need to set before I can use my macros.

Trusted Advisor
Posts: 2,113

Re: User macros not getting loaded at start up

That file name appears to be custom to your system; it does not show up on a Google search of SAS.  You may need to talk to your local admins.

As a workaround, you could include an options statement in your autoexec process flow in EGuide that includes the location in the SASAUTOS parameter (you can probably lift the code directly from apperver_autoexe_usermods.sas).

Doc Muhlbaier

Duke

PROC Star
Posts: 1,237

Re: User macros not getting loaded at start up

Hi,

Angela Hall has a nice summary of BI server autoexecs:

  http://blogs.sas.com/content/bi/2012/10/29/choosing_an_autoexec/

Maybe you want

  appserver_autoexec_usermods.sas

?  (note 'S' and 'C' are missing from your file name)

I haven't done much BI server admin.  Typically would think you would want to put this in a config file (defining an autocall library), rather than an autoexec that compiled the macro every time you start a session.

HTH,

--Q.


Super User
Posts: 3,115

Re: User macros not getting loaded at start up

So what is the code you are using in your autoexec? Are you using the AUTOCALL approach to reading your macros? If so your AUTOEXEC should look something like this:

filename myautos 'c:\myautos directory';

options sasautos = (myautos, sasautos);

The other issue as already discussed is are you modifying the right AUTOEXEC? If you are running a 'standard' BI Server setup then it is the SASApp autoexec_usermods that means to be changed. See the link to Angela's blog above for more details. Also confirm that EG is using SASApp - see in server list.

We successfully use this approach ourselves and it works fine for EG, batch jobs, WRS - in fact all SAS jobs.

Contributor
Posts: 20

Re: User macros not getting loaded at start up

 

Hi

I am not using BI. I have a program that is run through a batch process and which I edit in Enterprise Guide. Neither are using my macros.

My E:\SAS\Config\Lev1\SASApp\appserver_autoexec_usermods.sas has the following code.

filename SLmacros "F:\Prod\SASAUTOS";
options sasautos=( SLmacros, SASMACRO);

And my E:\SAS\Config\Lev1\SASApp\appserver_autoexec.sas

Has

%include "E:\SAS\Config\Lev1\SASApp\appserver_autoexec_usermods.sas";.

I have also tried using the code below within the program itself but this still does not work.
 
%INCLUDE 'E:\SAS\Config\Lev1\SASApp\appserver_autoexec.sas'; run;

Log entries are below

 
119 %LET mmm = %SetMMYY;
WARNING: No logical assign for filename SASMACRO.
WARNING: Source level autocall is not found or cannot be opened. Autocall has been suspended and
OPTION NOMAUTOSOURCE has been set. To use the autocall facility again, set OPTION
MAUTOSOURCE.
WARNING: Apparent invocation of macro SETMMYY not resolved.
120 %PUT &mmm;
WARNING: Apparent invocation of macro SETMMYY not resolved

PROC Star
Posts: 1,237

Re: User macros not getting loaded at start up

Hi,

Can you describe a little bit more of your setup?

You're using EG.

When you run EG, you could be connecting to a local server (i.e. SAS installed on your PC), or an SAS application server (installed on a unix/linux/windows/etc server).

If you have a unix/linux server, you need to point to the autocall directory using the unix/linux path, not a windows path.

Looks like maybe the problem is that you specified a fileref named "SASMACRO", which doesn't exist.

Assuming you are on a Windows server, then I think below should work (note I removed the comma, and changed SASMACRO to sasautos).

filename SLmacros "F:\Prod\SASAUTOS";
options sasautos=( SLmacros sasautos);  /*removed comma!*/

To check whether the SASAUTOS is set appropriately, you can start a new EG session, and try:

  %put %sysfunc(getoption(sasautos));


And another check would be to try to load the macro by:

  %inc "F:\Prod\SASAUTOS\setmmyy.sas" ;

If that %include won't work, it means SAS is not seeing the file with the macro definition.

HTH,

--Q.

Contributor
Posts: 20

Re: User macros not getting loaded at start up


Hi

Used your code provided changing SASMACRO to sasautos and it worked.

Thank you .

Ask a Question
Discussion stats
  • 6 replies
  • 533 views
  • 1 like
  • 4 in conversation