Editing in the Program window
Unlike UNIX, SAS is not case-sensitive. You can use capital or
lowercase letters in your program statements or SAS commands.
However, when you specify filenames (as you do with the include and
file SAS commands), you must type it exactly as it exists in UNIX.
This is because SAS needs to know the exact name in order to retrieve
the file from UNIX.
Moving the cursor:
You can move the cursor around on the screen by using the arrow keys
or by using the mouse. The arrow keys on the SUN workstations are on
the number pad. To use the mouse slide it over the mouse pad until
the on-screen cursor (the large arrow on the screen) is where you want
to be (in one of the SAS windows) and press the left mouse button.
The SAS cursor (a small rectangular box) will move to where the
on-screen cursor is positioned when you clicked the button.
Inserting Text:
When you start SAS, you are in typeover mode. This means that if you
type characters in the middle of a word, the characters will type over
the word. You may switch to insert mode, so characters are inserted
into the word instead. To do this press the 'INS' key on the number
pad.
This will switch back and forth between insert mode and typeover mode.
In insert mode, the cursor is an underline, in typeover mode it is a
block cursor.
Deleting Characters:
To delete a character, move the cursor to the character just after the
one you want to delete and press the delete key.
Line Number Area Commands:
The area in the Program window which shows line numbers may be used in
editing to manipulate the lines of your program.
To execute line commands, move the SAS cursor into the line number
area (right on top of the numbers) and type the line command over the
line numbers. Use only one line command at a time. Press the RETURN
key to execute the command.
Commonly Used Line Number Area Commands
- d deletes the line
- i or in inserts a line or inserts n lines after the current line
- m . . . . . a
moves line marked with m
after line marked with a.
- c . . . . . a
copies line marked with c
after line marked with b.
Example:
Before the command:
0024 I want this line to stay where it is
0025 Some SAS statement line
0026 This line to move after line 24
Issue the command:
0a24 I want this line to stay where it is
0025 Some SAS statement line
0m26 This line to move after line 24
The 'm' marks the line which should be moved.
The 'a' says to move the line marked 'm' after this line.
After the command:
0024 I want this line to stay where it is
0025 This line to move after line 24
0026 Some SAS statement line
Retrieving Programs
You can retrieve a file, bringing it into the Program window, by typing
include 'filename'
on the Program window command line, where filename is the name of the
file you want to bring into your SAS session. If you are using
pulldown menus, chose "Open -> Read file" from the "File" menu. This
may be a file you wrote yourself (and saved in an earlier SAS session
with the file command) or a file your instructor provided.
If you cannot remember what you named a progam in a previous session,
use the UNIX command (in the xterm window):
ls
to list the names of the files in your directory.
To list the contents of a text file type:
more filename
(where filename is the name of the file). In viewing a file this way,
you can press the spacebar to see the next screen, or type q to quit
and return to the system prompt.
To remove (or erase) a file type:
rm filename
(where filename is the name of the file). Note that there is no
unerase command so be careful removing files.