03-26-2009 06:12 AM
03-26-2009 06:23 AM
01-10-2017 01:31 PM
Use &syshostname instead of %syshostname
% is used to identify a macro, but & is used to show the value of a macro variable.
Needless to say, it's important to know the difference between a macro and a macro variable, but most people just call them macros.
03-28-2009 02:09 PM
04-01-2009 05:56 AM
04-01-2009 06:54 AM
01-10-2017 09:03 PM - edited 01-10-2017 09:12 PM
Whenever I can influence things, then I make sure that directory structures are identical between environments. I don't think coding environment smart within individual scripts is a good approach.
What's sometimes different is the "Root path". What I'm normally doing in such a case is to implement SAS macro variables in the Autoexec and so I keep all environment specific information in a single location for maintenance.
A libname statement would then look like:
libname myds "&data\subfolder1\subfolder2";
Where the "subfolders" are the part of the directory structure under my control and identical in all environments.
An alternative approach for libraries used in multiple programs would be, to define these libraries in SAS Metadata. This is again about keeping environment specific things in a central location and not spread out over many programs which becomes a maintenance nightmare in case something ever changes - and for example the host name will change when you upgrade to a current SAS version in a hopefully not too far future for you.
If you don't have the necessary level of access to modify the Autoexec or to change SAS Metadata then a 3rd option would be to create a %init macro with all these environment specific definitions. Store the macro code in a folder which is part of the SAS Autocall facility and then just call the macro always at the beginning of your programs.