02-06-2014 10:38 AM
I'm using EG 9.3 version 5.1. I have a macro that I created that works perfectly using %include. I am would like to add the macro to the autocall library and I've tried the following approaches but neither work. I'm including the code and the log for both attempts in the attachment. The code for the macro that I'm calling is included at the end. It is saved as 'pgm_cd.sas' on a unix server.
Any help would be appreciated. Thank you!
02-06-2014 01:03 PM
Try using --- options MAUTOLOCDISPLAY . Interesting that your request shows up as I am preparing a paper for 2014 SAS Global Forum. Here is a quote out of it:
"Macros are relatively easy to run from their native locations. This paper covers methods of doing this with emphasis on: (a) the option “sasautos” to define the location and the search order for identifying macros being called, and (b) even more importantly -- the little known SAS option “MAUTOLOCDISPLAY” to identify the location of the macro actually called in the saslog. What you think you are calling and what actually was called may be two different things."
This may or may not help you resolve your issues.
02-06-2014 04:57 PM
Thanks for your reply. I didn't see any results in the log that were different than the prior runs but I think you may be on to something. I am running these macros from my local windows machine on a remote unix server using EG. It looks like it's an issue with the path when I call the macro. Could the windows/unix translation be the foul up?
02-07-2014 09:52 AM
My first question here is do you have mautosource option on. I see that you do.
Here is an article that might help you some.
02-07-2014 01:03 PM
In addition to the path you need to take care with the filenames. For autocall to work the filename must match the macro name and on Unix this means that the filename must be in all lowercase. So if you want to use %mymacro() in your SAS code then the macro must be in a file name 'mymacro.sas'. When you %include you can by pass both of these issues as the filename does not need to match the macro name and the filename can include uppercase letters.
02-08-2014 03:30 AM
. I am running these macros from my local windows machine on a remote unix server using EG. It looks like it's an issue with the path when I call the macro.
Where (server) SAS compiles the macro is important!
Has that user account (on the SAS server) the rights to see and read from your macro folder on your EG client?
02-08-2014 06:34 AM
Good tips from all.
Tom's point about filenames on unix for macro autocall libraries killed about 1 day of productivity for me years back. We were moving a bunch of code to Windows, and I couldn't figure out why 1/3 of my autocall macros didn't work.
To that point:
1. Do the SAS-provided autocall macros work? i.e. %put %lowcase(AbCd) ; [I think that's an autocall macro, if not, %upcase() is, I can never remember... ]
2. If you copy your macro file to the same directory where the SAS supplied macro files are, does your macro work? If not, then it's probably the filename case problem. If it does, then it's probably a problem with your assignment of the autocall path or file ref.
02-14-2014 03:26 PM
Thanks Peter. That worked. The final syntax looked like this.
mautosource mstored mautolocdisplay;
The program was called pgm_cd.sas and it was located in this directory.
Thanks for the assist.
02-09-2014 03:29 AM
changes should be made at the config/Levx/<Appserver> usermod files you will find a/ autoexec b/ config c/ env.sh files for that.
This is a platform admin job. This guy should understand OS layers and SAS and ..... and the business. For HR-management simplicity that is not always done so you could have an issue with that.
The best thing is adjust a usermod-config file to a agreed location for the user-macro-s.
Some attention points:
- The default assumption is that the user-application is placed just in some mapping very close to those config/installation-files.
That coul be a failing approach by other manadatory guidelines.
You could use OS enviroment vars into namings (! instead of &)
- The relative path to those mapping is failing with the home location direction (change currrent dir and relatieve path fails - KB-notes).
- Never mix-up capitals in the SAS macro-names at OS level (hungarian style) . They will fail as only low-case chars in the namings will work.