'Life is after all a recursive summation, indeed     Let's do some Statistics!

  Context
 Conditions
 Downloads
 How to Setup

	
Return to CEE 700/800 Homepage
CEE 700/980 Access Counter
 
Boundary Conditions
 
Following information is designed to assist you on how to remotely access the ODU SAS Unix Application server and run SAS source codes from your PC over internet. Here, a remote PC is defined as any PC that is not physically attached to the ODU on-campus network, but has a capability to access the internet.

This instruction assumes that

  1. you have an Internet connection at home such as Cox cable, Verison DSL, etc., OR
  2. you have a LAN/Wireless network connection in your office, AND
  3. you're running either one of $icrosoft Windows 8/7/Vista/XP wintel machines. (i.e., following guideline is based on Windows software)
Program Downloads -- Where Can I Get One of Those...
 
Even though there're several terminal emulation and FTP programs are available from internet, you may find it bit difficult where/which to look for, and even you find one, the site happens to have an obscenely slow link. (statistically speaking, it usually falls into the Murphy's Law category)

Followings are all such programs you need for running SAS at ODU SAS Unix server, and they're already mirrored in CEE website for faster downloads to your PC. They're

  • Telnet - for accessing SAS Unix server and running SAS in a commond-line mode
  • FTP - for uploading/downloading file between your PC and SAS Unix server
  • PFE Editor - one of the best ASCII text editors for SAS source creation/editing

Telnet program is a bare minimum you should have (if you intend to write SAS source code in Unix), but a combination of telnet/FTP/PFE wouldn't be a bad idea either.

Click and download appropriate programs. (All programs are with a full GUI support)

Programs (8/7/Vista/XP) Download
Programmer's File Editor (PFE)
FTP program -- WinSCP (SSH)
Telnet program -- PuTTY (SSH)

For Mac users, your can use Mac OS-X built-in Terminal in place of Telnet (=SSH), and popular Fetch or similar FTP software in place of WinSCP (SSH). Alternative would be yet another popular program CyberDuck which has both SSH and FTP capabilities.

O.K., I Downloaded and Installed Programs, Now What...
 
First of all, if you do not have an ODU LIONS Unix account currently, create your own LIONS Unix user account first by activating your ODU MIDAS (Monarch IDentification and Authorization System)

Once you have your LIONS user account created, then review Intro to SAS and Remote Access Guide to LIONS pages first, review example SAS sources, then use turing.hpc.odu.edu SAS application server to run your SAS source. (turing user account needs to be created separately once you have your LIONS Unix user account ready)

You're pretty much all set now, indeed. Here's the logistics for preparing, uploading & downloading, and executing your SAS source via a batch job process at turing SAS application server;

Creating/Editing a SAS source

  1. Using a text editor ( PFE program is recommended), write a SAS source code. (or simply Copy/Paste available SAS source code(s) and modify)

    General introduction to SAS source code structure and syntax is available. Take a quick look before moving to next step.
    
    
    
    Keep in mind that DO NOT use 'Tab' key in your SAS source code, -- use 'Space' key instead -- else you'll get tons of errors later. Once finish writing your SAS source code, save it with a file extention of 'sas.' (i.e., 'abc.sas')

    In PFE, you can easily Search/Replace all existing 'Tab' to 'Space' (such as after copying data columns from Excel to PFE);

    1. move the cursor at the top of current file -- use <Ctrol> + <Home>
    2. use 'Edit/Replace' (or 'F3'), and put \t (special character for 'Tab') for a 'Find What' string, and put a couple of <Space> (2 or 3 spaces) for 'Replace With' string. Then click on 'Replace All' button.

    BTW, there is another thing that you should be careful when you're saving your SAS source code. A normal MS-DOS (or Windows) text file format uses CR-LF as a line terminator (for 'Next Line') in contrast to Unix text file format using just a LF. Here, CR denotes for 'Carrige Return' and LF for 'Line Feed.'

    Thus if you save your SAS source code in a MS-DOS text file format and upload to Unix, and run SAS, certainly you'll get a number of error messages due to that extra 'CR' character (which is invisible on screen), and start feeling like banging you head to the wall...

    As usual, every problem has its remedy (either known or unknown). PFE is able to save files in either the normal MS-DOS format (CR-LF) or in Unix format (LF). The format used to save a file is determined by one of the file modes - the Save in Unix Format mode - that you can associate with a file. You can set this mode in several ways:

    • You can check the Unix format box in the dialog shown when you use the File/Save As command. This will save the current file in UNIX format, and will also set the Save in Unix Format mode so that this becomes the default format when you write the file to disk again.

    • You can double click the left mouse button in the area of the status bar that shows the file format until it shows the word "Unix".

    • You can check 'Use UNIX convention (LF) for end-of-line' checkbox in the dialog started from Options/Current Modes menu. This also makes Unix format the default for every time you write the file to disk.

    
    
  2. Again, you should remember *NOT* to use <Tab> key for spacing. If you use <Tab> key(s) to put space between data columns, you'll have quite encryptic error messages all over your LOG file. Instead of <Tab> key, use <Space> key (a.k.a. 'hard space') put delimiting space if necessary.


Connecting to turing Unix server (Telnet)

  1. Install SSH (Secure Shell) Telnet client (PuTTY) program first, if you have not done so.

    SSH is a high-security protocol compared to the standard Telnet protocol which offers only a minimal security. It uses strong cryptography to protect your connection against eavesdropping, hijacking and other attacks. (i.e., your login ID, password and all commands that you type will be encrypted)

  2. Start SSH (Secure Shell) Telnet client (PuTTY) program and connect to SAS Unix server.

    At 'Host Name' box, type the SAS Unix server address turing.hpc.odu.edu, select 'SSH' protocol, and save the setting with a session name of your choice (let's say '0_turing'). Now, double clicking on the sassion name (i.e., '0_turing') will connect you to ODU turing SAS application server. Once you have login prompt, log in with your turing login ID and pasword.

    You would further configure your terminal size (=Window), default font (Window/Appearance) and screen colors (Window/Colours), etc. For further configuration details on SSH Telnet client, please see its usage note.
    
    
  3. For specific Unix commands, please refer to the ' Introduction to Unix' link from the class homepage.


Uploading/Downloading file(s) to/from turing Unix server (FTP)

  1. Install SSH (Secure Shell) FTP client (WInSCP) program first, if you have not done so.

    SSH-based FTP (SecureFTP+Secure Copy) is a high-security protocol compared to the standard FTP protocol which offers only a minimal security. (i.e., your login ID, password are encrypted during file upload/download)

  2. Start SSH (Secure Shell) FTP client (WinSCP) program to connect to turing FTP server. You will see a blank session setup dialog box.

    At 'Host Name' box, enter the turing Unix server address turing.hpc.odu.edu.

    At 'User name' box, enter your turing user ID, i.e., your MIDAS user ID in a format of 'abcde00n.' Hence, do *NOT* put 'jyoon' -- that is not your User ID!

    DO NOT enter your login password. Also, DO NOT click on 'Save' button yet.

    Be sure NOT to save your password even though you're the only one using this FTP program from your home or office. Saving a password into a session profile is a major security concern, and you should never ever do that.

    Since you're not entering password information now, you'll be prompted for password each time the FTP program connects to ODU turing FTP server.

    
    
  3. Click on 'Directories' under 'Environment' in Configuaration Panel in the left.

    • At 'Remote directory' box, enter 'sas' subdirectory in your login directory path in the turing Unix server. It will be

      /home/[your User ID]/sas

      For example, if your User ID is 'carpa001,' then your Remote directory path is

      /home/carpa001/sas

      Another example, if your User ID is 'roxad003,' then your remote directory path is

      /home/roxad003/sas

      Keep in mind that even though you set your 'Remote directory' to 'sas' subdirectory in your login directory, there is no such 'sas' subdirectory exists **at this moment** -- you will create it when you establish the first FTP session to turing FTP server.

    • At 'Local directory' box, enter 'c:\sas' -- a 'sas' folder in your C-drive. (Please do create 'sas' folder in your C-drive now before you forget!)
    
    
  4. Click on 'Save' button at the bottom to save your turing FTP setting. You will see 'Save session as' dialog box.

    Give a session name of your choice. For instance, I name the session as '0_turing.'
    
    
  5. As you click on 'Save' button, you will see following FTP(=WinSCP) login screen.

    To login to turing FTP server, either

    • double-click on the session you just saved -- '0_turing' for example, or

    • select the session you just saved -- '0_turing' for example, and click on 'Login' button at the bottom.

    Since you intentionally did not save password information to the session setup, program will ask for your password. Enter your password and click 'Ok' for establish a FTP session to turing FTP server.

    
    
  6. Once you are connected to turing FTP server, you will see a double-pane FTP interface screen similar to one as shown below. Left side pane is your PC directory, and right side pane is turing Unix server directory.

    Keep in mind that you set your 'Remote directory' as

    /home/[your User ID]/sas

    That means you do not have 'sas' subdirectory yet in your login directory. Let's create it now.

    Click on the directory bar on right side pane (i.e., turing Unix side), and press 'F7' to create a directory 'sas' in your turingr Unix account.

    
    
  7. To upload a SAS source from your PC (C:\sas) to turing FTP server 'sas' directory, select/click on your SAS source file in the left side pane and press 'F5.' (or click, hold and drag the file(s) to turing Unix side)

    
    
  8. The same manner, to download file(s) from turing FTP server 'sas' directory to your PC (C:\sas), select/click on file(s) in the right side pane and press 'F5.' (or click, hold and drag the file(s) to your PC side)


Executing/Running your SAS source in Unix

  1. Back to Telnet/Putty program (remember, you're already connected to SAS Unix server via Telnet).

    First, from now on, $ denotes the "common" Unix system prompt since the system prompt contains your user ID and will be different to user to user. For example, my system prompt would look like

    [jyoon@turing2 ~]$

    whereas user "jadam004" system prompt would look like

    [jadam004@turing2 ~]$
    
    
    *CHANGE* to your sas directory by typing - DO NOT TYPE '$' as a part of next command;

    $ cd sas <Enter>
    
    
  2. You will execute the SAS source code in a SGE (Sun Grid Engine) batch mode at system prompt. For example, if your sas source file is 'abc.sas,' then type following in the command prompt (case-sensitive);

    $ sasq abc.sas <Enter>

    Then, the system will acknowledge with a message;

    Your job #### ("SAS") has been submitted.

    where #### is a system-assigned, numeric job ID assigned to your batch job.
    
    
  3. Keep in mind that when your're executing a SAS source in this SAS batch mode, it will only confirm that your SAS job was submitted to SAS application server -- there will be no further message in regard to your job's 'progress status.'

    However, you can make a quick check on you batch job status by typing following command;

    $ qstat -u [your user ID] <Enter>

    For example, an user "jadams004" would check one's batch job status by typing;

    $ qstat -u jadams004 <Enter>

    Or simply type

    $ qstat <Enter>

    to list all batch jobs currently running/queued in turing HPC server. (and find yours from the list)

    • Typically, a simple SAS batch job completes almost instantly -- so that when you type 'qstat' it may have already completed your batch job, and you would not see yours in the list!

    • For a "heavy" batch job (i.e., iterative nonlinear optimization, etc.), 'qstat' will give you a whereabout of your batch job status. Look for a line that contains 'sas' and your user ID -- status 'qw' means 'batch job queued & waiting for execution' and 'r' means that your batch job is currently running (=executing).
    
    
  4. After submitting your batch job, your can check whether your batch job has been completed or not by listing current directory ;

    $ ls -al abc* <Enter>

    where ls (=list) is a Unix command for listing files in a directory, and -al is flags/options for ls command -- "all" and "long format." For more information on this ls command, or in that reagrd, basic Unix commands and a crash course to Unix, you may consider further taking a look at Introduction to Unix material.

    When issuing above ls command to check the result of your SAS source execution, there are two typical outcomes;

    Outcome #1 (Good!)

    you have following five files;

    abc.sas (your original SAS source that was submitted via 'sasq')
    abc.log (execution log)
    abc.lst (output or 'listing' file)
    SAS.a[ID] (batch job [ID] output log)
    SAS.e[ID] (batch job [ID] error log)

    It means that 'at least' your SAS source went through batch job process, and produced an output(=listing) file 'abc.lst' corresponding to instructions in your 'abc.sas' source.

    Batch job log files, SAS.a[ID] and SAS.e[ID] files were created automatically each time you submitted a batch job, and you can ignore these batch job log files and delete them for housekeeping.

    Keep in mind that you still need to examine the execution log file (abc.log) to verify that there was no error in your original sas source, abc.sas.

    Outcome #2 (No good!)

    you have only following four files;

    abc.sas (your original SAS source that was submitted via 'qsas')
    abc.log (execution log)
    SAS.a[ID] (batch job [ID] output log)
    SAS.e[ID] (batch job [ID] error log)

    and no output or 'listing' file (i.e., abc.lst)!!

    It means that your SAS source has an error(s) and was *NOT* able to generate the output (=listing) file due to either syntax error or logical error or both.

    A syntax error(s) is the cause of let's say, 98% of all imaginable errors -- you had mistyped/misspelled/omitted SAS procedure and/or variable name(s) or order/format of your data was not correct. A logical error means that you are asking SAS to calculate something it cannot under given data/procedure/option, etc.

    You need to find out which part(s) of your sas source has the error by examining the execution log file (=abc.log), edit your sas source (=abc.sas) to correct such error(s), save the changes, then need to re-submit the batch job.

    Again, remaining batch job log files, SAS.a[ID] and SAS.e[ID] files were created automatically each time you submitted a batch job, and you can ignore these batch job log files and delete them for housekeeping.

    
    
  5. Next step is to examine your execution log file (i.e., 'abc.log') to determine whether the execution of your source code was really successful. To examine your log file, you would

    1. either open the log file in a text editor;

      $ nano abc.log <Enter>

      and search (Ctrl+w) for a string "error." When you done, exit from nano by pressing Ctrl+x. For a quick reference on nano editor, please see >> here <<.

    2. or do a string pattern match without openning the log file using 'egrep' command,

      $ egrep -in "error" abc.log <Enter>   
    
    
    If you see any 'ERROR' message in your log file, you have either SAS syntax error(s) or logic error(s) in your SAS source (=abc.sas). Examine such 'ERROR' message carefully -- it usually points out which part/line of your SAS source code caused the error.

    If you have 'ERROR,' debug (=correct) your SAS source code(=abc.sas) by

    • either using a text editor (such as nano) in Unix to correct error(s), save and re-submit your batch job.

    • or, in your PC, editing/modifying your SAS source to correct error(s), save it, re-upload it via FTP, then re-submit your batch job.
    
    
  6. If you see no 'ERROR' message in your log file, SAS source execution was successful. Go ahead, delete log file ('abc.log') and download output file (= listing file 'abc.lst') to your PC using FTP program.

    Select your SAS listing file, 'abc.lst' from the right window and click on 'F5 Copy' or 'F6 Move' to download the file(s) to your PC. After file transfer is done, you'll see downloaded files displayed in the left window in your PC. You can now open and print the file.

  7. Disconnect Telnet connection by typing exit at the system prompt. Then quit the Telnet/ssh program.

  8. Close/Quit FTP connection/program by clicking on 'F10 Quit'.

  9. For further detail on programs you downloaded from this webpage, please refer to their Help or User's Manual.

For more information on general SAS structure and source coding details, please see SAS Structure page.

Example Runs

Let's do three SAS run examples with step-by-step procedures discussed above. We will use three example SAS src files for this exercise -- good.sas, bad.sas and ugly.sas. As names imply, these three example SAS srcs are with no error, single error and five errors.

Example #1) good.sas (with no error)

OPTIONS LINESIZE=72;
TITLE1 'SAS Run Example #1 -- good.sas';
TITLE2 '** UNIVARIATE PROCEDURE **';
DATA ChemHC;
INPUT Purity H_Carbon @@;
CARDS;
90.01 0.99   89.05 1.02   91.43 1.15
93.74 1.29   96.73 1.46   94.45 1.36
87.59 0.87   91.77 1.23   99.42 1.55
93.65 1.40   93.54 1.19   92.52 1.15
90.56 0.98   89.54 1.01   89.85 1.11
90.39 1.20   93.25 1.26   93.41 1.32
94.98 1.43   87.33 0.95
;
RUN;

PROC PRINT;
PROC UNIVARIATE FREQ PLOT NORMAL;
  VAR Purity;
RUN;

  1. Copy&Paste above SAS src into PFE editor, Save it As "good.sas" with "Unix format" option box checked.

  2. Upload "good.sas" to your turing account by using FTP program.

  3. Log in to your turing account by using Telnet/ssh program.

  4. Execute uploaded "good.sas" in the command prompt (case-sensitive);

    $ sasq good.sas <Enter>

    Then, the system will acknowledge with a message;

    Your job #### ("SAS") has been submitted.

    where #### is a system-assigned, numeric job ID assigned to your batch job.

  5. After submitting your batch job, your can check whether your batch job has been completed or not by listing current directory ;

    $ ls -al good* <Enter>

    If you see the log file, that means that your SAS job has been completed. Next step is to see whether SAS job executed correctly without any error.

  6. Check the log file for any error.

    $ nano good.log <Enter>

    and search (Ctrl+w) for a string "error" which you should not have. When you done, exit from nano by pressing Ctrl+X. For a quick reference on nano editor, please see >> here <<.

  7. You should not have any error for this example -- "good.sas" -- and your listing should look like >> this <<.

Example #2) bad.sas (with single error)

OPTIONS LINESIZE=72;
TITLE1 'SAS Run Example #2 -- bad.sas';
TITLE2 '** UNIVARIATE PROCEDURE **';
DATA ChemHC;
INPUT Purity H_Carbon @@
CARDS;
90.01 0.99   89.05 1.02   91.43 1.15
93.74 1.29   96.73 1.46   94.45 1.36
87.59 0.87   91.77 1.23   99.42 1.55
93.65 1.40   93.54 1.19   92.52 1.15
90.56 0.98   89.54 1.01   89.85 1.11
90.39 1.20   93.25 1.26   93.41 1.32
94.98 1.43   87.33 0.95
;
RUN;

PROC PRINT;
RUN;

PROC UNIVARIATE FREQ PLOT NORMAL;
  VAR Purity;
RUN;

  1. Copy&Paste above SAS src into PFE editor, Save it As "bad.sas" with "Unix format" option box checked.

  2. Upload "bad.sas" to your turing account by using FTP program.

  3. Log in to your turing account by using Telnet/ssh program.

  4. Execute uploaded "bad.sas" in the command prompt (case-sensitive);

    $ sasq bad.sas <Enter>

    Then, the system will acknowledge with a message;

    Your job #### ("SAS") has been submitted.

    where #### is a system-assigned, numeric job ID assigned to your batch job.

  5. After submitting your batch job, your can check whether your batch job has been completed or not by listing current directory ;

    $ ls -al bad* <Enter>

  6. Check the log file for any error. Let's use "egrep" command this time instead of scrolling down the bad.log file line by line.

    $ egrep -in "error" bad.log <Enter>

    It will display the error in your SAS src with a line number.

  7. Correct the error in "bad.sas" by using PFE in your PC, save it over with the same filename "bad.sas," re-upload, and re-run. Your corrected result, "bad.lst" listing file should look like >> this <<.



Example #3) ugly.sas (with five errors)

OPTION LINESIZE=72;
TITLE1 SAS Run Example #3 -- ugly.sas';
TITLE2 '** UNIVARIATE PROCEDURE **';
DATA ChemHC;
INPUT Purity H_Carbon @@
CARDS;
90.01 0.99   89.05 1.02   91.43 1.15
93.74 1.29   96.73 1.46   94.45 1.36
87.59 0.87   91.77 1.23   99.42 1.55
93.65 1.40   93.54 1.19   92.52 1.15
90.56 0.98   89.54 1.01   89.85 1.11
90.39 1.20   93.25 1.26   93.41 1.32
94.98 1.43   87.33 0.95


PRUC PRINT;
RUN;

PRUC UNIVARIATE FREQ PLOT NORMAL;
  VAR Purity;
RUN;

  1. This time, let's Copy&Paste above SAS src directly into "nano" editor in Unix, skipping PFE editor and FTP upload from your PC.

  2. Select/Highlight above SAS src with your mouse, then Copy (Ctrl+C).

  3. Log in to your turing account by using Telnet/ssh program.

  4. Create "ugly.sas" SAS src by using "nano" editor.

    $ nano ugly.sas <Enter>

    Then, paste the example src directly into "nano" editor by pressing <Shift>+<Insert> key combination. Save and Exit by pressing Ctrl+X. (type "y" for yes when it ask whether you want to save the changes) For a quick reference on nano editor, please see >> here <<.

  5. Execute "ugly.sas" in the command prompt (case-sensitive);

    $ sasq ugly.sas <Enter>

    Then, the system will acknowledge with a message;

    Your job #### ("SAS") has been submitted.

    where #### is a system-assigned, numeric job ID assigned to your batch job.

  6. After submitting your batch job, your can check whether your batch job has been completed or not by listing current directory ;

    $ ls -al ugly* <Enter>

  7. Check the log file for any error. Let's use "egrep" command this time.

    $ egrep -in "error" ugly.log <Enter>

    It will display errors in your SAS src with corresponding line numbers -- note the erros and line numbers for correction.

  8. Correct the error directly in "nano" editor, skipping PFE editor and FTP upload from your PC.

    $ nano ugly.sas <Enter>

    Once all five errors are correctly corrected, save and exit from "nano" by pressing Ctrl+x. (type "y" for yes when it ask whether you want to save the changes) For a quick reference on nano editor, please see >> here <<.

  9. Re-run -- your corrected result, "ugly.lst" listing file should look like >> this <<.


Return to CEE 700/800 Homepage Return to CEE 700/800 Homepage Move to the Top of this page