06-25-2012 09:30 AM
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.
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:
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?
06-25-2012 11:39 AM
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?
06-25-2012 01:23 PM
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.
-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
06-26-2012 12:53 AM
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.
06-26-2012 05:00 AM
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).
07-27-2012 07:18 PM
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.
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.
08-28-2012 10:11 AM
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');
08-28-2012 12:59 PM
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: