Running SAS Remotely from the Statistical Computing Facility

1  Introduction

In order to run SAS from a remote (non-SCF) computer, you must have a program which uses the secure shell (SSH) protocol to communicate with other computers. An SSH program alone will not allow you to run the SAS Display Manager, or to view graphics or images. For these purposes, you need an X Windows server (sometimes known as X11) either running natively on your computer, or via an X Windows emulator.
Depending on your operating system, one or both of these programs may already be installed on your computer. The next section will explain how to obtain the necessary programs if they are not already available, followed by an explanation of the commands necessary to connect and run SAS. Finally, information on transfering files from the SCF to your local computer is presented.
If you don't have a broadband connection, you may find that the response when using X Windows remotely may be too slow to be useful; even with a broadband connection, SAS may seem nonresponsive at times. With patience, you should be able to use SAS remotely with few problems.

2  Usernames and Hostnames

In the examples that follow, the username you should provide is the login name on the SCF account sheet distributed in class; all usernames for this class begin with s100.
Check here for names you can use when hostname appears in an example.

3  Software

3.1  Linux

Linux natively runs the X Windows system, and most Linux systems have the ssh program available to securely connect to remote systems.

3.2  Mac OS X

The ssh command is available through the Terminal application (available in /Applications/Utilities/Terminal.app). For versions of Mac OS X since Panther, there is an installation package for X11 on the Developer Disk.

3.3  Microsoft Windows

To connect to the SCF remotely, you can use a free program called putty. You can download it from http://www.chiark.greenend.org.uk/ sgtatham/putty/download.html. This will allow you to run programs remotely, but it will not allow you to use the display manager, or to view graphics. To do this, you need an X Windows emulator. If you have a CalNet ID, you can download Exceed 2008 from UC Berkeley Software Distribution. A free alternative to Exceed is the Cygwin X Windows System. There are excellent instructions for installing this software at Cygwin/X. Basically, you first download a program called setup.exe, which makes it possible to install a wide variety of software; you need choose only five packages: xorg-server, xorg-scripts, xinit, inetutils and openssh (Clicking on the View button in the setup.exe window until it displays "Full" makes it easier to find the packages you need). Once everything is installed there should be a Cygwin icon on your desktop. Double click on the Cygwin icon and type
/usr/bin/startxwin.sh

in the window that opens. Another window will open and you can use the ssh command as described below. (Notice when you use Cygwin, there's no need for the putty program, since Cygwin provides the ssh command.) The User's Guide covers just about every step of installation and use of the software.

3.4  Commands

3.4.1  Microsoft Windows: putty

To use putty with an X Windows emulator, you need to make one change to the default settings: In the left-pane, click the X to the left of SSH under Connections, and click on X11. Check the box marked "Enable X11 forwarding". Once this is done, you can connect to the SCF by choosing "Session" in the left hand pane, filling in a valid hostname, and clicking "Open". When you're connected, type
sas &

After a while, the SAS display manager will appear.

3.4.2  The ssh command

If you're using a system with the ssh command, type
ssh -X username@hostname

to connect to an SCF computer, and then type
sas &

to start your SAS session. The -X (upper case X) in the ssh command sets up the X11 Tunneling necessary for displaying graphics.

4  File Transfer

If you want to print out your programs, listings and graphics on your local printer, the easiest route is to copy the files from the SCF computers to your computer and then to print them in the usual way. The best way is to use a file transfer program on your local computer, although other means are possible. (Check here for instructions on printing when you're in the SCF computer room.)
You can save programs and listings directly from the SAS display manager by choosing File -> Save As from the appropriate menu bar. To save graphics, choose File -> Print from the graphics window menu bar, and click on the Print to File check box. Next, click the Properties button, and choose the Destination tab. Finally, enter a filename in the Destination field, and click on OK in both windows. Graphics are stored in PostScript format. If you're not sure if your computer can view and print PostScript graphics, enter the following command in the same window from which you started SAS:
ps2pdf filename.ps

where filename.ps is the filename you specified in the Destination field. You can then copy the resulting pdf file to your computer and view or print it with Adobe Acrobat.

4.1  Linux

The command line scp command, described below, is probably the best way to transfer files from one computer to another. If you'd prefer a graphical client, programs like konqueror will accept the sftp:// protocol. For example, if your username is s100xy, you would be able to access your files on the SCF computers by going to
sftp://hostname.berkeley.edu/class/u/s100/s100xy

4.2  Mac OS X

The command line scp command, described below, can be accessed through the terminal (/Applications/Utilities/Terminal.app). Although the finder doesn't directly support the sftp protocol, the freeware program Fugu provides a nice graphical frontend to the sftp command. To use Fugu, enter your username and an appropriate hostname in the Connect to: field; you'll be prompted for a password when Fugu connects to the remote server. Your remote files will appear in Fugu's right-hand pane, where they can be dragged and dropped to a location of your choice in the (local) left-hand pane.

4.3  Microsoft Windows

There are a number of free graphical sftp clients available for Windows; one nice and easy-to-use one is WinSCP. If you choose the Explorer view instead of the default Norton Commander view, your SCF account will appear as a normal explorer window, allowing you to drag and drop files; simply enter your username and a suitable hostname to connect.

4.4  If All Else Fails

If you can't use the previously described methods, you can email files from the SCF system to an email account of your choice. One way is to use the command line program pine. To send files as attachments with pine, enter the following command in the same window from which you started your sas session:
pine emailaddress -attach file1 -attach file2 ...

After hitting Return, type control-X to send the mail, and Y to confirm it. Note:  There is a 5 Mb limit on attachments to emails sent through the SCF. While this should pose no problems with text files saved from the program editor, complex graphics may be too large to send through email. Please check the size of the file you're sending (with the UNIX command ls -l) before reporting a problem.

4.5  The scp command

The syntax for the scp command is:
scp username@hostname:file local-directory

You'll be prompted for your password; after entering it and hitting Return, the file transfer will start.
To use wildcard patterns on the remote (SCF) machine, precede the wildcard character with a backslash (\). For example to copy all the SAS files from your SCF account, to the current directory on your local computer, use a command like:
scp username@hostname:\*.sas .




File translated from TEX by TTH, version 3.67.
On 7 Aug 2009, 15:23.