Search the world wide web...
Google
 

Saturday, January 7, 2012

How to invoke SAS GUI (unix) using X Window

If you are a SAS user on Unix/Linux, you might want to use X Window for your SAS application. In my example, I’ll show you how to invoke SAS 9.2 for Unix/Linux from a windows based OS using batch script.
We will need two main components:

1) X Windows – I’m using a free Xming software version 6.9.0.31

2) SAS 9.2 for Unix/Linux

In this example, we assume that SAS 9.2 have been installed in a Unix box. Next, install Xming in your windows machine. Run Xming-6-9-0-31-setup.exe. Just click next and accept default setting. During Xming installation, it will also install plink – a command prompt putty which will be use to connect to the Unix box.

After Xming installation, you will see Xming icon in your desktop as per picture above. Ensure to update PATH variable to Xming installation directory which plink.exe reside (i.e. C:\Program Files\Xming), in order for us to run plink anywhere in our Windows machine.

Next step is to create a batch script in your windows machine. Create an empty batch file (create a file and rename it to something.cmd) and put the following script in the file:

@echo off
@ You can set any comment here
COLOR 17
mode con:cols=82 lines=30
TITLE Put title here
echo########################################################################
echo#                                                                      #
echo#                                                                      #
echo#                                                                      #
echo#                                                                      #
echo#                     You can put your own text here                   #
echo#                                                                      #
echo#                  ...........Starting SAS 9.2.........                #
echo#                                                                      #
echo#                                                                      #
echo#                                                                      #
echo#                                                                      #
echo########################################################################
start "" C:\Progra~1\Xming\Xming.exe :0 -clipboard -multiwindow
plink -ssh -X -pw password yourid@192.1.1.1 ./startsas

I’ve created a soft link inside the server and put the link inside /home/yourid so that I can run the SAS start command inside my home directory. You can manipulate the way you start the SAS software depending on your SAS setup. Make sure port 22 is open in order to connect to the server via SSH protocol. The –X option in the plink command enable the usage of X Windows so that SAS can be run using GUI. You will see something like this when running the script:
The script will automatically start the Xming software, and then connecting to Unix box to run SAS software. So now you only have single click to run your SAS Unix software in your windows machine! You can modify the script according to your need i.e. prompting password if you don’t want to hard code your password inside the script.

To terminate the script/SAS, just click on terminate button in one of the SAS panel.