How to set up autocall macros on a Unix server

Accepted Solution Solved
Reply
Contributor
Posts: 34
Accepted Solution

How to set up autocall macros on a Unix server

Hi,

While switching from Windows to Linux, I am facing a problem with autocall option of SAS.

The following works on Windows but does not work on Linux. So my question is how to set up autocall macros on Linux.

filename mymakros "/data/SAS_Projekte/SAS_Makros";

filename umakros "/data/SAS_Projekte/SAS_Makros/Utility_Makros";

options mautosource sasautos=(mymakros umakros sasautos);

thanks in advance for your help

Ehsan


Accepted Solutions
Solution
‎11-13-2014 11:41 AM
New Contributor
Posts: 4

Re: How to set up autocall macros on a Unix server

Two things you might try:

1) try coding these explicity as below:

mautosource sasautos=('/data/SAS_Projekte/SAS_Makros', '/data/SAS_Projekte/SAS_Makros/Utility_Makros', '!SASROOT/sasautos');

mrecall;

2) make sure that the macros that you create in '/data/SAS_Projekte/SAS_Makros' and '/data/SAS_Projekte/SAS_Makros/Utility_Makros' are saved in lowercase.  For example, if you have a macro called mymacro, you should save it in one of those directories as mymacro.sas.  It will not work on a Unix server if saved as MyMacro.sas with uppercase.  

View solution in original post


All Replies
Solution
‎11-13-2014 11:41 AM
New Contributor
Posts: 4

Re: How to set up autocall macros on a Unix server

Two things you might try:

1) try coding these explicity as below:

mautosource sasautos=('/data/SAS_Projekte/SAS_Makros', '/data/SAS_Projekte/SAS_Makros/Utility_Makros', '!SASROOT/sasautos');

mrecall;

2) make sure that the macros that you create in '/data/SAS_Projekte/SAS_Makros' and '/data/SAS_Projekte/SAS_Makros/Utility_Makros' are saved in lowercase.  For example, if you have a macro called mymacro, you should save it in one of those directories as mymacro.sas.  It will not work on a Unix server if saved as MyMacro.sas with uppercase.  

Contributor
Posts: 71

Re: How to set up autocall macros on a Unix server

We run SAS on Linux. The macro libraries can also be defined in one of your SAS server configuration files, for example SASROOT/sasv9_local.cfg

-sasautos ('!SASROOT/sasautos' '/data/SAS_Projekte/SAS_Makros' '/data/SAS_Projekte/SAS_Makros/Utility_Makros' )

This would apply to all SAS programs that are run without their own configuration file.

Are you actually going to put macros in /data/SAS_Projekte/SAS_Makros? If not, you just need:

-sasautos ('!SASROOT/sasautos' '/data/SAS_Projekte/SAS_Makros/Utility_Makros' )

Valued Guide
Posts: 3,208

Re: How to set up autocall macros on a Unix server

This move to Unix (Linux) is often going along with a BI/DI server approach.

going from PC Personal Computer to a server is also changing the world to a multi-user environment

Multi user:

Do not touch the file SASROOT/sasv9_local.cfg as that one is for the whole machine-environment.

This includes the hardware/machine tuning. Leave those to the guys installing the machine and SAS.

AppServer:

These are the files that are setup for SAS business applications. WS-server SP server etc. There are a lot of usermod config files there in a dependent structure.

For the sas-config ones there are also several of those.    

There can be as many appservers being defined as there are business applications that association "sas business application = appserver " is an architectural correct one in the BI/DI approach.

Options usage:

There are better/new  ways to configure settings.  SAS(R) 9.3 System Options: Reference, Second Edition  use the insert option statement.

Keep you hands off what has been set up, just define what is needed to be added. 

The only needed statement in the usermods_config of the appserver will be something like:  

   -insert sasautos '/data/SAS_Projekte/SAS_Makros/Utility_Makros'

I think you will get into troubles seeing your naming convention, for the following reason: YOU ARE ON UNIX.

Unix is case sensitive in filenames and spelling the case up/low inconsistent will result in errors. But SAS is case-insensitive.

Do not store sas-macros (unix files) there having uppercases  in their name. SAS is translating all macro-calls to lower cases before searching for them on the OS level.

SAS(R) 9.3 Companion for UNIX Environments (guidelines naming macros) 

There are more issues around the appserver usage.

To be posted when needed.

---->-- ja karman --<-----
Contributor
Posts: 34

Re: How to set up autocall macros on a Unix server

thank you very much guys, according to the sugestions of data_ailment and boschy vevery thing works now. Life is beautiful again :-)

cheers

Contributor
Posts: 34

Re: How to set up autocall macros on a Unix server

Hallo Jaap Karman,

as you have already mensioned some issues while switching from Windows to Unix. I need your help and expert opinion on "Importing CSV files in sas under Unix". I am working using Enterprise Guide on a unix server. I am finding difficulties in avoiding "blank spaces", "end lines" and some special charecters while reading CSV files. It was not the case when i was using Windows. Can you please give some hints to avoide these issues. I mean what are the best practices to deal with these issues ?

regards

Ehsan

New Contributor
Posts: 4

Re: How to set up autocall macros on a Unix server

Below are a few things that might start to point you in the right direction on this in addition to some tips from Jaap.

1) If you first FTP files from Windows to Unix, then use PROC IMPORT or data step INFILE.  An option to FTP within Enterprise Guide is found at this link.  There and back again: copying files in SAS Enterprise Guide - The SAS Dummy.  One feature it has is a checkbox that allows you to "fix line endings" on the FTP from Windows to Unix.  See also the comment from October 19, 2013 on that link about how to FTP csv (or other files) from Windows to your WORK directory with this FTP add-in using %sysfunc(pathname(WORK)).

2) If you FTP the csv files to Unix without fixing line endings and you want to use a data step INFILE process to read the data, you will need to use the TERMSTR correctly (probably TERMSTR=CRLF which take a Windows text file and changes it to Unix text file line endings).  See this 14178 - INFILE's TERMSTR= option facilitates reading files betweenUNIX and Windows.

3) If you FTP the csv files to Unix and using PROC IMPORT to read them, you might set your GUESSINGROWS option to a really high number and see if that helps some.

4) Another option you might try is to use the Enterprise Guide point-and-click File--Import on a small subset of your data and make sure that all of your informats are set up correctly on this small data set.  Then do the import and grab the code that EG generates on this import process (if it imported as you wanted).  Then FTP the full file, and use that code you now have to create the dataset on the full file.

Valued Guide
Posts: 3,208

Re: How to set up autocall macros on a Unix server

The CR-LF  LF difference is a nasty one. You can upload/download binary and then specifying the correct one.

CSV:

IF you are having CSV files from Excel with a hard enter (LF). Leave them in Windows format and process those with termstr=cr/lf

As long as the systems are not expecting Unicode but latin1 (which one?) that is the only issue.

Using Eguide drag/drop you can put files at Unix in binary mode setting (drag windows  - drop Unix files of the server side)  

I prefer the datastep approach avoiding the guessing of proc import, guessing implies failures.

Unicode

SAS source files are beter to be converted. The Unicode vesion of SAS is adding a BOM-marker that is sometimes causing unreadable files as the Unicode is not being expected.
For the fun EGuide is processing Unicode characters but when the SAS-session is latin1 that one does not. 

As your are mentioning spaces and special chars as a problem it looks you are getting into this. Do you some informations on what encoding are used on what part?      

---->-- ja karman --<-----
Contributor
Posts: 34

Re: How to set up autocall macros on a Unix server

thank you very much to both of you for nice suggestions. Copy files Add-In menstioned by "data_aliment" is an amazing tool.

@Jaap: I do not exectly know the encoding always. I get CSV or TXT files without any info. about encoding and quality of files.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 8 replies
  • 833 views
  • 9 likes
  • 4 in conversation