BookmarkSubscribeRSS Feed
mdavidson
Quartz | Level 8

Hello --

I've set up an autocall macro library on our SAS server (UNIX, SAS EG 4.3) by adding the following option to the config file: -SET SASAUTOS ("***macro path****")

This works just as intended, all of the macros in the "macro path" folder are available to the session.  However, I'm running into problems when running stored processes which reference those same shared macros.  I know the sasutos option should be in the usermods file, but I've inserted the sasautos option in all of the following files but I've still had no luck.

./opt/biserver/Lev1/SASMeta/sasv9_usermods.cfg
./opt/biserver/Lev1/SASMeta/WorkspaceServer/sasv9_usermods.cfg
./opt/biserver/Lev1/SASMeta/MetadataServer/sasv9_usermods.cfg
./opt/biserver/Lev1/SASMeta/BatchServer/sasv9_usermods.cfg
./opt/biserver/Lev1/SASApp/sasv9_usermods.cfg
./opt/biserver/Lev1/SASApp/StoredProcessServer/sasv9_usermods.cfg
./opt/biserver/Lev1/SASApp/WorkspaceServer/sasv9_usermods.cfg
./opt/biserver/Lev1/SASApp/PooledWorkspaceServer/sasv9_usermods.cfg

I was doing some reading and came across this note: http://support.sas.com/kb/32/231.html which references multiple config files being referenced by the stored process server:

  1. Store the .sas files for the user-created AUTOCALL macros in a directory other than the ones listed above, which must be concatenated into the SASAUTOS system option search path. The default SASAUTOS directory search path is determined when SAS initializes by reading the SAS configuration file(s) associated with the installation.

Multiple SAS configuration files are read by default when a stored process is executed through a workspace server or stored process server. For example, in a Windows environment the SAS configuration files read by default will be similar to this:

<BIConfigDir>\Lev1\SASMain\StoredProcessServer\sasv9_StorProcSrv.cfg <BIConfigDir>\Lev1\SASMain\sasv9.cfg !sasroot\sasv9.cfg !sasroot\nls\en\SASV9.CFG 

Any ideas on what config files on UNIX I need to modify to make my autocall library available to the stored process server?

7 REPLIES 7
Patrick
Opal | Level 21

I would have thought that in a standard installation ./opt/biserver/Lev1/SASApp/sasv9_usermods.cfg will be used by all servers under SASApp.

If this is not the case then you start best with the .cfg which is called by the Stored Process Server and then look there what other .cfg are included.

If you want the autocall macro library available for all servers then adding it to ./opt/biserver/Lev1/SASApp/sasv9_usermods.cfg should be sufficient. I wouldn't define it again in all the server .cfg's as this makes maintenance more complicated and also adds the same path twice.

What exactly is not working? Are you sure that you're using the Stored Process Server under ./opt/biserver/Lev1/SASApp/StoredProcessServer?

mdavidson
Quartz | Level 8

Here's what is not working.  When I open EG and run one of the autocall macros I don't have any problems.  When I run that same macro via stored process, the macro fails (ERROR 180-322: Statement is not valid or it is used out of proper order. ) So for some reason the stored process server is not referencing the autocall library.


I first modified the ./opt/biserver/Lev1/SASApp/sasv9_usermods.cfg file and still ran into the same problem.  Then I even went one step furthur and modified the

/opt/SAS/SASFoundation/9.2/nls/en/sasv9.cfg file, and I still have the same problem.


Here's what my sasv9.cfg file looks like:


--

[root@sas02 en]# more sasv9.cfg

/*

   This config file contains the default SAS configuration option settings

   which are defined during the SAS Foundation Installation process. This file

   gets recreated during SAS Installation Upgrade process therefore user

   specified settings added to this file will be lost during an upgrade. With

   this in mind, we strongly discourage editing this file, as the edits will

   be lost on upgrade. A new configuration file named sasv9_local.cfg has

   been created in the !SASROOT directory to store user specified settings.

   Settings in this file will remain in place during upgrades to this SAS

   Installation and will override the default options values when the same

   options are contained in both places.

*/

/*

   Default options:

*/

-insert sashelp !SASROOT/nls/en/sascfg

-insert helploc !SASROOT/X11/native_help

-SET SASAUTOS ("***macro path***")

--


And I checked, yes the stored process is running via SASApp - Logical Stored Process Server.  I'm going to have to get with my UNIX admin and open up the config file located in ./opt/biserver/Lev1/SASApp/StoredProcessServer




shivas
Pyrite | Level 9

Hi,

I have tried adding the -sasautos ("E:\path\ucmacros" "SASEnvironment/sasMacro" SASAUTOS) in the

configuration directory E:\SAS\Config\Lev1\SASApp\sasv9_usermods.cfg(it worked properly in SAS stored process web application).

After adding the path I restart sas object spawner services.Hope it helps.

Thanks,

Shiva

Patrick
Opal | Level 21

I'd probabely add on top of ./opt/biserver/Lev1/SASApp/StoredProcessServer/sasv9.cfg an insert for  ./opt/biserver/Lev1/SASApp/StoredProcessServer/sasv9_usermods.cfg

... and then on top of  ./opt/biserver/Lev1/SASApp/StoredProcessServer/sasv9_usermods.cfg an insert for  ./opt/biserver/Lev1/SASApp/sasv9.cfg

./opt/biserver/Lev1/SASApp/sasv9.cfg should already have an insert for ./opt/biserver/Lev1/SASApp/sasv9_usermods.cfg

You then could add your SASAUTOS extension to  ./opt/biserver/Lev1/SASApp/sasv9_usermods.cfg so that this code is in one central place and gets active for all servers.

Make also sure that the folder containing the macros can be read by SASSRV (or whatever user the stored processes server uses to execute programs).

DonH
Lapis Lazuli | Level 10

There is an option that you can set in the metadata to specify the name of a program to run before each stored process. You can also define a program to run after the completion of each stored process. You can also define such programs at the session level.

I don't have 9.2 anymore, but here is how you do it in 9.3. And I believe it is the same in 9.2. Note that this was a new feature added in 9.2.

  1. Login to SAS Management Console
  2. On the Plug-Ins tab, expand Server Manager
  3. Expand the name of your App Server (e.g., SASApp)
  4. Right click on the appropriate logical stored process server
  5. Go to the Options tab
  6. Click the Set Server Properties button
  7. Select the Request tab
  8. Define the path for the programs to run before (and/or) after each stored process

I use this almost all the time to set autocall libraries, issue libnames based on the user, etc. All the macro vars that are available to your stored process are available to the program that is run before the stored process, as is the user id (i.e., &_metauser). So you can even do user specific things.

Note however that what you put here run before EVERY stored process. So don't overload it.

mdavidson
Quartz | Level 8

Thanks Don.  That's a goood tip, I was not aware of that option.  What does your initilization program look like?  Something like this?

filename mymac "***path***";

%include mymac ('*.sas');

DonH
Lapis Lazuli | Level 10

Since I work for multiple clients, I don't have a single standard. I try to minimize what it does and typically limit it to defining librefs, filenames, updating the fmtsearch or sasautos option.

It looks like you are trying to define macros. If so, I would use the SAS autocall facility to define the path to my macros. And I would use the insert or append options so as to make sure to not remove anything defined in the autoexec for the stored process server itself. Here is a link that talks about the insert and append options:

http://www.sascommunity.org/wiki/Dynamically_Insert_and_Append_SAS_Format_and_Macro_Libraries_within...

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 3402 views
  • 1 like
  • 4 in conversation