You are on page 1of 3

SAS UNIX:

SAS UNIX:

1. Unix environment?
SAS can effectively be used with Unix operating system. We have some options that
would let the programmer to extract files from the terminal as well as save the Output to
the terminal.

2. When would you use UNIX instead of PC SAS?


When we need to submit the program in a batch/ non-interactive mode.
When we are concerned with security issues.

3. What operating systems can you sit down at today and be productive?
I can be productive on Unix and Windows system.

4. Are you comfortable at the command line?


A. Yes, I am comfortable at the command line mode.
I can write commands like for listing all files (-a), Listing directory itself (-d) and ls, ls-l
privileges.

5. Setting permissions?
A) r Read permission
w Write permission
x Execute permission
- no permission
Change permissions on file
Chmod [options] file
Chmod u + w file [gives the user (owner) write permission]
Chmod g + r file [gives the group read permission]
Chmod o x file [removes execute permission for others]

6. Can you write shell scripts?


A. Yes, I can write shell scripts. I have used the VI editor (multiple commands) (n editor,
single line) to write shell scripts (which is a group of commands to be executed at once).
Command VI opens the editor.
(Escape..colon wq) for saving any file and will quit the editor.
For executing the shell scripts we write the filename.sh
I have written a shell script to match a user id to a persons name.

7. Do you know how to use the VI editor?


A. It uses standard alphabetic keys for command. We can create a newfile by this
command. VI filename.In command mode, the letters of the keyboard perform editing
functions (like moving the cursor, deleting text, etc.). To enter command mode, press the
escape key SAS can effectively be used with Unix operating system. We have some
options that would let the programmer to extract files from the terminal as well as save
the Output to the terminal.

SOME UNIX COMMANDS


(commands should be typed in lower case letters - I can't get my Webpage software to
accept lower case letters in the table!)

Ls lists the files in the current directory

More filename displays a file on the screen

Cp oldfile newfile makes a duplicate (copy) of oldfile under the name newfile

Mv oldfile newfile moves or renames a file

Rm filename Removes or deletes a file

Lpr filename Prints a file on the acs printer at the batch window,
111 Cummington St.

Cd directory changes current directory to directory

Cd .. changes current directory to parent directory

Cd changes current directory to home directory

Pwd show current directory

Mkdir dirname makes (creates) a new directory

Rmdir dirname removes (deletes) a directory

Man commandname display manual (help) for specified command

A nice feature of UNIX is that it provides programmers with the flexibility of scheduling their job
in the system, emailing the result and log file, and reporting the running status. The following
code can be a standard UNIX shell script for those functions.
#!/bin/ksh
export PATH="$PATH/opt/sas8"
# Initializing variables
date1=`date +%m/%d/%y`
# Remove Previous output files
# Starting code execution
echo 'Starting to run the sas Job' > sas_job.log
echo Start Date: $date1 >> sas_job.log
sas run.sas -noterminal
echo 'Finished running the sas Job' >> sas_job.log
date2=`date +%m/%d/%y`
echo End Date: $date2 >> sas_job.log
# Sending Log File via email
uuencode run.log run.log | mailx -s "LOG FILES" jhe@solucient.com
# Sending MS files via email
(uuencode stat.xls) | mailx -s "EXCEL FILES" jhe@solucient.com
exit 0

You might also like