Remotely running SAS in Interactive Mode using ESS

SAS is probably the most acclaimed data analysis and Business Analytics software currently available in market. It is used primarily for data analysis in academic and research institutions, and for data mining in business and enterprises.

SUMMARY
If you do not have SAS in your computer but have access to a remote server where it is installed, this article is for you. I have summarized the process of running SAS program interactively (not in batch mode) on a remote server with the aid of two popular software-- Emacs and ESS. You need to have these software installed on your PC (either Linux or Windows-based computers are fine but Linux would be more convenient).

BACKGROUND
Since 9.2 version of it, SAS Institute has changed their license policy and that made it impossible for me to have a copy of SAS from my university. My university installs SAS only for the professors. We have SAS 9.2 installed in our graduate computer lab and also in the central computational server. My only option was to run SAS remotely by loggin in to the Academic Research and Computing (ARC1) server at University of Windsor.

ARC1 runs the Unix version of SAS 9.2 (as of January 25, 2010). I need to login via ssh and work with SAS in batch mode. Unlike SAS in Windows, the Solaris in ARC1 server do not provide any graphical environment for running SAS. Batch mode processing is the only option (to my knowledge). For command line interface (CLI), once you are logged in to the server, go to a folder (or create if needed) where you want to store your SAS program (.sas), SAS log (.log) and SAS output (.lst) files. You can then use vi or pico or any other editor for creating a SAS program file. To run SAS in batch mode, use sas filename.sas at the terminal prompt.

SOLUTIONS
Apart from running SAS 9.2 in batch mode, there are two other ways of working with it interactively. (1) by loading SAS from a Linux PC via ssh -X or (2) by connecting SAS server via Emacs + ESS.

To load SAS graphical interface, you need to login to server using the following options with ssh:
ssh -X username_nospace @servername.com Note the capital X, not small x.
This will load SAS on your local linux box with a graphical interface. Remember that -X options in ssh. Without this -X option, you cannot load the graphical interface of SAS remotely.

The second option is to run SAS remotely via ESS. ESS stands for Emacs Speaks Statistics. For an introduction to ESS and Emacs, please read this post. I am listing the steps needed to successfully connecting to a remote server running SAS and loading SAS to ESS buffer and then running SAS interactively.

  1. Load your Emacs. On a terminal, type emacs or emacs &. The latest version of GNU Emacs is 23.x.
  2. Load the ssh library: Type Alt+x load-library and then type ssh. I assume that you have already put the ssh.el file in your directory path. If not, then download it from here.
    and put it in /usr/share/emacs/23.1/lisp/ (assuming that this is your emacs path). Also make sure that the following is in your .emacs file located in your unix home folder, usually under /home/username/

    (require 'tramp)
    (setq tramp-default-method "ssh")
    ; Emacs Load Path
    (setq load-path (cons "/usr/share/emacs/23.1/lisp" 
    load-path))

  3. Once the ssh library is loaded, type Alt +x ssh. Then enter your userid @ servername. Provide your password when prompted.
  4. You are at the terminal of your remote server. Now its time to run SAS. type sas -stdio
  5. Type Alt+x ess-remote
  6. At the prompt, type sas
  7. Load your file. Type the path (either local file or remote file. For remote file, you have to provide path beginning with your user_no_space @domain.com:/path/to/file/file.sas
  8. Go to the buffer where SAS is running. Then Alt+x ess-sas-interactive
  9. Now go back to the program buffer and start editing (or) processing your codes. To submit a single line, use Ctrl+c Ctrl +n

ess-sas-emacs.png
Now expand your emacs window and split it using the command Ctrl+x 3. To browse the buffers, use command Ctrl+x left-arrow or Ctrl+x right-arrow

SHORTCUTS
Here I am listing a few shortcuts for ESS[SAS]. The command is not case sensitive, meaning that capital letters in the commands can be small letters.

Ctrl+C Ctrl+N to submit one line to the SAS buffer
Ctrl+C Ctrl+spacebar to start selecting a region. Use your arrow key to go up or down to highlight the area you want to select.
Ctrl+C Ctrl +G to cancel selection
Ctrl+C Ctrl+R to submit the selected region to the SAS buffer
Ctrl+C Ctrl+B to submit the entire buffer to the SAS buffer.

USEFUL LINKS
ESS process on remote computers:
http://www.xemacs.org/Documentation/packages/html/...

About Interactive ESS process (I couldn't get them working for remote servers)
http://www.xemacs.org/Documentation/packages/html/...

Some ESS shortcuts, may be useful for ESS[SAS] as well
http://www.stattler.com/article/emacs-latex-and-es...

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • LaTex commands embedded in text will be interpreted and rendered. Additional information can be found at DruTex Documentation Pages
    • Assists automatic numbering of tex, equation, and equations environments.
    • Provides different environments to create rendered images (especially maths).
    • You may use <swf file="song.mp3"> to display Flash files inline
    • You can use BBCode tags in the text.

    More information about formatting options

Google Video

Loading...
Loading...