SAS/Connect allows you to establish a "connection" between SAS running on your PC and SAS running on Koti. Once connected, you can issue commands to SAS on your PC to interact with SAS on Koti. These commands provide you the ability to manage, access, and process data in a distributed and parallel environment. For example, from SAS on your PC you can issue commands to SAS on Koti to process a data file stored on Koti and then send the results back to SAS on your PC for you to display locally.
This web page describes how to set up such a connection between SAS on your PC and Koti, and it provides a few examples of actual SAS/Connect commands you can use.
To establish such a connection, you can use SAS 9.3 or 9.4 on your PC. You must use the "traditional" SAS programming environment --- not SAS Studio, SAS OnDemand, SAS University Edition, or SAS Enterprise Guide. You will be connecting to SAS 9.4 (TS1M6) on Koti.
Because Koti is approved for and may house sensitive data, you are required to use a secure connection between your PC and Koti. To obtain a secure connection, you must use a method known as SSH tunneling, as will be explained below. With SSH tunneling, first you create a secure "SSH tunnel" (connection) between your PC to Koti. Then you establish a SAS/Connect "session" between SAS on your PC and SAS on Koti so that all information that is exchanged between them will be sent through that tunnel. The information that is passed through the tunnel (in both directions) is encrypted before transmission and then unencrypted upon receipt.
The instructions below describe a one-time preliminary step that must be performed (editing the 'tcuunix.scr' SAS file), followed by instructions for setting up an SSH tunnel and then establishing a SAS/Connect session between your PC and Koti. Finally, a few practical examples are given of using SAS/Connect commands.
For complete information, please see the SAS/Connect documentation.
Before you can use SAS/Connect with Koti, you must edit and change two lines in the tcpunix.scr SAS text file on your PC. This is a one-time procedure.
The tcpunix.scr file is located here:
Here !SASHOME represents the folder where SAS is installed on your PC (which is usually C:\Program Files\SASHome). If unsure where SAS is installed, a quick way to find out is to launch SAS and submit the following SAS command:
libname a '!sashome';
and then look in the SAS log window for the location of the folder.
Open the above tcpunix.scr file in the Windows Notepad text editor program and perform the following steps (to launch Notepad, you can hold down the Windows key Screenshot of the Windows key logo. [View Image] on your keyboard and type Notepad and then press Enter):
waitfor '$' , '>' /*-- another common prompt character --*/ , '%' /*-- another common prompt character --*/ , '}' /*-- another common prompt character --*/ , 30 seconds ; type 'logout' LF; log 'NOTE: SAS/CONNECT conversation terminated.'; stop;
* waitfor '$' , '>' /*-- another common prompt character --*/ , '%' /*-- another common prompt character --*/ , '}' /*-- another common prompt character --*/ , 30 seconds ; * type 'logout' LF; log 'NOTE: SAS/CONNECT conversation terminated.'; stop;
To preserve the original file, use the File / Save As menu to save this modified file under a different name (such as tcpunix-KOTI.scr) and/or in a different folder. When we refer to this file in our instructions below, for simplicity we will assume that you have named and saved it as follows:
Warning: If you instead use Microsoft Word or other word processor program to edit this file, be sure to save it as a "text" file.
This completes the editing of the tcpunix.scr file. This is a one-time procedure.
In order to use SAS/Connect, you must first establish a secure "SSH tunnel" (connection) between your PC and Koti. Then you must issue a few special SAS commands on your PC to establish a SAS/Connect session with Koti.
To establish the secure SSH tunnel, proceed as follows (this procedure requires Windows 10):
Open a Command window on your PC. To do this, you can hold down the Windows key Screenshot of the Windows key logo. [View Image] on your keyboard and type cmd and then press Enter.
In the ensuing Command window, type or copy/paste the following command, and then press Enter:
ssh -L 8888:192.168.66.65:51234 firstname.lastname@example.org
being sure to replace jdoe with your Koti account name. Note that it is assumed here that port 8888 is unused on your PC (if you don't know what that means, then it probably is unused). Port 51234 has been set up on Koti for use with SAS/Connect. The '192.168.66.65' is Koti's address.
If you now see the following:
The authenticity of host 'koti.vcu.edu (192.168.66.65)' can't be established. RSA key fingerprint is SHA256:hD/gsNnrWue/zzw0lSaSdHrKpAJQUQe/plsPICLb/SM. Are you sure you want to continue connecting (yes/no)?
type yes and press Enter.
When prompted, enter your Koti account password and press Enter.
You will then receive a Koti command prompt (not shown here).
Although you could now enter Unix commands here to perform on Koti, you do not need to do anything further in this Koti session. By simply logging in using the above command, you have established the secure SSH tunnel through which SAS/Connect can communicate to Koti (as explained below). But you MUST REMAIN LOGGED IN while you use SAS/Connect, so that the tunnel continues to exist.
Now launch SAS 9.3 or 9.4 on your PC (you must use "regular" SAS --- not SAS Studio, SAS OnDemand, SAS University Edition, or SAS Enterprise Guide).
Enter the four SAS commands shown below in your SAS program editor window., modifying the first command appropriately, so that it contains the name and location of the tcpunix.scr file that you edited and saved in the previous section above (we are using 'c:\vcu\tcpunix-KOTI.scr' in this example).
filename rlink 'c:\vcu\tcpunix-KOTI.scr'; options comamid=tcp; %let koti=localhost 8888; signon koti;
Submit (run) these commands within SAS. These commands will initiate a SAS/Connect session with Koti. You will be prompted to enter your Koti user id and password (not shown here).
After you correctly enter your user id and password, the SAS/Connect session with Koti will be established, and you should see the following line at the bottom of your SAS log window:
A secure connection between your PC and Koti has now been established, and you are ready to use SAS/Connect.
You may now issue any appropriate commands, as desired, while this connection is maintained. We give a few examples of such commands in the Examples of Using SAS/Connect section, just below. For complete details, please see SAS/Connect documentation.
When finished, you should terminate your SAS/Connect session by typing and submitting the following command in your SAS editor window:
You should then see the following line at the bottom of the SAS Log screen:
Finally, to terminate the SSH secure tunnel to Koti, simply log out of your Koti session that you had initiated in the Windows Command window.
Below are some examples of commands that could be issued with SAS/Connect to perform various tasks. In these discussions, the term local refers to events or files on your PC, and the term remote refers to events or files on Koti.
All of the commands below are typed and submitted in the SAS program editor window on your PC. Commands that are intended to be executed remotely by SAS on Koti are "sandwiched" between RSUBMIT and ENDRSUBMIT commands. You should select (highlight) and submit the entire RSUBMIT sandwich (that is, all of the SAS commands from RSUBMIT to ENDRSUBMIT, inclusive). Do NOT, for example, highlight and submit those commands one at a time.
Some of the pathnames (e.g., x/y/z) used below refer to files or directories on Koti, and some refer to those on your PC. Because Koti will only accept forward slashes ("/") in pathnames, and Windows will accept either forward ("/") or backward ("\") slashes, for simplicity we have only used forward slashes ("/") in all situations.
Remember that before you can submit these commands, you must initiate a connection between SAS/Connect on your Windows PC and Koti and receive the Remote sign on to KOTI complete message, as described in the previous section.
In this example, a PROC FREQ is run remotely on Koti to produce a frequency table for a SAS dataset that is stored on Koti.
RSUBMIT; LIBNAME abc "MyKotiFolder/ASubFolder"; PROC FREQ DATA=abc.MyKotiSASDataset;
TABLES educlevel region; RUN; ENDRSUBMIT;
In this example, a local libref (abc) is defined to refer to a folder stored on Koti. A PROC FREQ is then run locally on your PC to produce a frequency table for a SAS dataset in that folder.
LIBNAME abc "MyKotiFolder/ASubFolder" SERVER=koti;
PROC FREQ DATA=abc.MyKotiSASDataset; TABLES educlevel region;
Example 1 and Example 2 both produce a PROC FREQ of the remote dataset. But there are differences:
This example demonstrates how to use the Output Delivery System to produce local RTF output (on the PC) from a PROC PRINT that is executed remotely on Koti.
ODS RTF BODY="C:/MyLocalFolder/MyFile.rtf"; RSUBMIT; LIBNAME abc "MyKotiFolder/ASubFolder"; PROC PRINT DATA=abc.MyKotiSASDataset; RUN; ENDRSUBMIT; ODS RTF CLOSE;
This example demonstrates how to upload (copy) SAS files from a folder on the local PC to a folder on Koti.
LIBNAME local 'C:/MyPCFolder/ASubFolder'; RSUBMIT; LIBNAME remote "MyKotiFolder/SomeSubFolder"; PROC UPLOAD INLIB=local OUTLIB=remote MEMTYPE=(DATA CATALOG); RUN; ENDRSUBMIT;
Note that, because the local SAS files were created by SAS on the PC, they were created in the Windows SAS file format. But the uploaded SAS files that are stored on Koti are automatically converted ("migrated") to Koti's SAS file format (Linux X64).
In this example, as in Example 2, a local libref, named abc, is defined that represents a remote folder on Koti. After executing this LIBNAME command, you can use the SAS Explorer window in your local PC SAS session to view, and even edit, the SAS datasets that are stored in that remote folder on Koti.
LIBNAME abc "MyKotiFolder/ASubFolder" SERVER=koti;
After executing this command, in your local PC SAS session you may now display your SAS Explorer window (click the Explorer tab in the lower-left corner of your SAS screen) and then double-click Libraries. One of the librefs listed should now be abc. Double-clicking abc will display all the SAS datasets that are stored in that remote directory on Koti. You can now perform various actions on those datasets, for example:
This article was updated: 01/12/2021