A basic overview furnished by SAS Institute can be obtained by typing 'man sas'.
You may wish to work from a "personal subdirectory", which means you would routinely "cd" to a subdirectory other than your home directory. SAS, however, can be invoked from any subdirectory. The examples below will assume that files are stored and/or written to the current subdirectory (i.e., the directory from which you invoked SAS). (Files that are not stored in the current subdirectory may be used, and may be specified using the ~/ convention to stand for your home directory.)
http://www.usc.edu/its/doc/statistics/sas/faq/v8/
SAS changed the structure of SAS data sets in Release 7, as compared with prior releases of the system. SAS data sets created in prior releases will be readable in Release 7 and higher, but those created in 7 and higher will not be usable in previous Releases. In other words, SAS data sets are upwardly, but not downwardly, compatible with respect to Release 7 and beyond.
If you have SAS data sets created prior to release 7, SAS can read most of them in later versions without special attention, but it may be to your advantage to convert your SAS data sets for use in Version 7 or later. It is possible in many cases to make conversions without using any SAS engines, since the default engine for new SAS data sets is the one appropriate for the most recent version, and SAS automatically uses the appropriate engine for any SAS data sets it needs to read. In SAS documentation, however, the engines are specified, so these examples will follow that style.
Some of the following steps are recommended, some required, in converting SAS data sets, and each step is so labeled.
sasdata, and you might
create a new directory called v8data to store
the new data sets.
UNIX example:
libname old v612 '~/sasdata';
libname new v8 '~/v8data';
proc copy in=old out=new;
libname old v612 'c:\sasdata';
libname new v8 'c:\v8data';
proc copy in=old out=new;
~/sasdata
(or c:\sasdata).
http://www.usc.edu/its/doc/statistics/sas/faq/v7problems/no604.shtml
setenv MYKLUDGE ~myfriend
and then refer to it in your SAS program as follows:
libname herdir '$MYKLUDGE';
Of course, in this example MYKLUDGE and herdir are arbitrary -- you can use any valid word of your choice -- and ~myfriend should be the actual username you want to access. NOTE: The techniques outlined in this paragraph will work in any SAS for UNIX installation, but are necessary only for SAS running on ferret. In other platforms, ~username should be fine.
In the SCF, users of this (or any) statistics software need to add the following lines to their .login file:
if (-e /usr/usc/stats/setup.csh) then
source /usr/usc/stats/setup.csh
endif
SCF and RCF users whose .login or .cshrc files are non-standard or who once had setup files for one or more specific statistics packages sourced in .login or .cshrc may need to fix their .login or .cshrc files to eliminate redundancy and/or to allow the system's automatic setup to take effect. For example, users on the RCF may have modified their .login or .cshrc to such an extent that the system's automatic setup is bypassed. These users can either restore the system's automatic setups (recommended) or add the lines shown above (which are usually only necessary for SCF users). Please call UNIX consulting (see last page) for help with these files.
Also, if your SAS session terminates abnormally (i.e., it ends without you typing "endsas" or "bye" at a command line), or if a SAS "batch" job ends prematurely, you will probably have work files remaining in the SASWORK subdirectory. (The default subdirectory for SASWORK is /tmpsas0 -- a system subdirectory only for automatically-generated SAS work files, not for user storage or other use -- unless you invoke SAS with the "-work" parameter and direct the work files elsewhere.) It is expected that you will delete your work files if your job or session terminates prematurely. This is most easily done by starting up another SAS interactive session (or running a batch SAS job), since the shellscript that invokes SAS also cleans out any previous work files owned by you. Work files usually are not usable in future sessions, and they just take up public disk space (if they are in /tmpsas0 or other public temporary space) or your own disk space allocation (if you have redirected the -work files when invoking SAS). Please delete old work files when SAS terminates abnormally.
The default in SAS for allocating temporary working space is to create such space in the public /tmpsas0 directory; furthermore, the default is to make the files used for working space temporary, which means that SAS clears them away each time you end a SAS session normally. SAS provides a method by which you can ask these files to be saved permanently, instead of having them deleted automatically. Instead of letting SAS use the -work default (or instead of specifying your own -work location), use -user instead, as in the following example:
sas -user ~/sasworkfiles
sas at any
UNIX prompt. SAS will load its full-screen interactive system
called Display Manager (DMS), which consists of the Output window,
the Log Window, and the Program Editor, as well as the
newer Explorer and Results navigation windows.
Your cursor will be in the Program Editor, ready to begin.
The default location for SAS to make and use its temporary working files is $HOME/saswork, that is, the saswork subdirectory of your home directory. It is possible to invoke SAS and redirect the workspace to a place with more space. If you need a larger workspace, see the section below entitled "Using Large Data Sets in the UNIX Environment.
The default amount of main memory that SAS can use for its work is set at 64 Megabytes. While almaak and aludra are powerful machines with more than 300 Megabytes of main memory available, it is also the case that at any given time these machines can have a number of users. If there were no limit on the amount of the machine's memory SAS could use, one large SAS job could grab the whole machine. Another related setting is sortsize, for which the default is 50 MB. Users may increase these defaults at the time SAS is invoked, but you are advised to be considerate of other users and ask only for the memory you will actually need. In no cases should any one user ask for more than 200 MB of main memory without checking first with the Statistics Consultant. To invoke SAS with more than the default values of memsize and/or sortsize, use the following syntax:
sas -memsize 100M -sortsize 80M
Of course, you don't need to increase both parameters except in cases where sortsize would exceed memsize. In all cases, memsize must be equal to, or greater than, sortsize. As you can see, if your job needs more memory, but does not perform any sorting, you don't need to specify sortsize at all.
On UNIX workstations, the X window software can be CDE,
Sun OpenWindows, or MIT X Windows, among others.
In this environment (X Windows on a UNIX workstation),
to run the X version of SAS, you need to open a window
and make sure the DISPLAY variable is set to your local machine.
At USC, the best way to get to the host where SAS will run is to
use the ssh (secure shell) command.
This command opens a new window, encrypts the transmission between
your machine and the host that will run SAS,
and sets the DISPLAY variable to
the same setting as the window (or console) from which the
ssh command was typed.
In general, the following steps will prepare the way for your SAS
X Windows session (the example uses almaak, but you may
substitute the name of any machine that can access SAS):
First, make sure the DISPLAY variable is set to your local machine in
the window where you'll type the ssh command
(or in the window where you will be running SAS, if you have
not used the ssh command).
Type echo $DISPLAY, and if you do not see 'undefined
variable', then you should be able to proceed successfully.
If you do see 'undefined variable', or if you get errors
indicating a problem with the DISPLAY, then define the DISPLAY
with some form of the following command:
where "machinename" is the name or IP address of the workstation you
are using. Here are two examples of how this command might look:
setenv DISPLAY <machinename>:0
(Of course, cabernet or 128.125.999.999 in the above examples
would be replaced with the
actual name or IP address of your machine.)
setenv DISPLAY cabernet:0
setenv DISPLAY 128.125.999.999:0
To learn the IP address on a UNIX workstation, go to a console window and type:
sysinfo | grep AddressTo learn the IP address of a Windows PC running NT, click on Start>Programs>Command Prompt and type:
IPCONFIGTo learn the IP address of a Windows PC running Windows 95 or 98, click on Start>Programs>Command Prompt and type:
WINIPCFGTo learn the IP address of a Macintosh, click Apple Menu>Control Panel>TCP/IP, and the IP address will be shown in the middle of the box.
Now, to open the window in which SAS will be invoked, at your local machine (e.g., the console window), type:
ssh almaak
This opens a window on remote almaak with the DISPLAY set to
your local machine.
Of course, if your account is in the SCF, you would substitute
aludra in the above command.
Then, when you invoke SAS, you should get the X-window version.
You can change these settings easily, by moving to the key you
wish to "program" and typing in the function you wish the key to
have.
When you
leave the keys window (by typing "end" on the command line or
using the Function key associated with "end"), the key settings
you have changed will replace the old ones in your profile, which
is stored in a subdirectory called "sasuser". (You should not
molest the sasuser subdirectory, as information is saved there
from session to session.)
Note that whenever the profile is
changed this, or any other way, it is a good idea to make a backup
copy of the profile.sct01 file in case it might get
corrupted at some future point.
This is discussed below, with suggestions for avoiding such
problems, in the section titled "Problems with SAS processes
under UNIX".
Typical functions assigned to Function (or other special) keys are: Help, Keys, Log (move to the Log Window), Output (move to the Output Window), Next (move to the next window down), Program (move to the Program Editor), Zoom (and hitting it again is Zoom Off), Recall, and SUBmit. (Note: SUBmit is often enhanced by being programmed as "Zoom Off; SUBmit". It can also be programmed as "Zoom Off; End", which has the same effect, as "End" is a synonym for SUBmit in the Program Editor.)
At ITS, the key settings for SAS on the RCF and SCF have been standardized as much as possible so that users switching between different terminal types will encounter minimal differences. Standard key settings are:
F keys SAS Function
(VT100)
--------------------------------------------------------------
F1 help
F2 keys
F3 end
F4 recall
F5 pgm (i.e., move to Prog Editor)
F6 log
F7 output
F8 zoom off;submit
F9 zoom
F10 rfind
F11 forward (not all emulations have
F12 backward (the F11 and F12 keys
keys
at a command line, or click Help>Keys.
Key Sequence Function
--------------------------------------------------
^U Home
^E Erase EOL
^X Insert
^D Delete
TAB key Tab
Backspace key backspace
Keypad-"." backspace
^H backspace
^I Tab
ENTER key linefeed
^J linefeed
Carriage Return linefeed
^C break
^T move to previous word
^K move to start of line
^L move to end of line
^W delete word
--------------------------------------------------
Up Arrow cursor up
^P Previous (cursor up)
Down Arrow cursor down
^N Next (cursor down)
Right Arrow cursor right
^F Forward (cursor right)
Left Arrow cursor left
^B Backward (cursor left)
The primary documentation for SAS on UNIX is the SAS OnlineDoc(tm) which is available at the USC Web site (restricted to computers registered in the USC domain 128.125.; see the end of this document for details.) Older documentation for Version 6 of the SAS System also is available, and is still applicable, though newer features obviously are not included. At the end of this document you will find a list of relevant SAS documentation and where to find it.
The left six columns of the screen are a line-number field that functions as an indication of where you are typing at any given moment, and also serves as a place to type "line commands" that facilitate your editing session. Some line number commands are "i" (insert a line), "d" (delete the line), and "r" (replicate, or copy, the line). You may also delete a group of lines by typing "dd" on the first line, and another "dd" on the last line of the block of lines you wish to delete. "c" is another line command that allows you to copy a line to anyplace in your program. The use of "c" requires the use of "a" or "b" on the line "after" or "before" which you want the copied line to appear. There is also "cc" . . . "cc" for copying blocks of lines to another place designated by "a" or "b". For complete instructions on using line commands, see the References listed at the end of this document.
To the right of the line-number field, and taking up most of the Editor window, is the data area where you type and modify your programs. When you have some SAS statements you wish to run (they need not be an entire program, just enough statements for SAS to do some work), type a RUN; statement after the last statement in each group you SUBmit (only one RUN; statement normally is needed each time you SUBmit). You actually SUBmit the program by typing SUBmit on the command line of the Program Editor or by hitting F10 (or whatever key is set up in the KEYS window to substitute for the SUBmit command).
You will see your program and any warnings, notes or error messages appear in the Log window, and your output, if any, will appear in the Output Window. If your program resulted in errors or warnings, or if you wish to continue building or writing your program, you will need to return to the Editor either to revise your program or to add more commands, and then once again SUBmit your revised or new program.
Command==> include '<UNIX filename>'
Command==> include '~/sasprogs/project5.program'
This will read the file from disk and place a copy of it in the Editor. You may submit it immediately, if it is a complete (accurate) program, or you may edit it and then submit it.
To write out to a file the contents of the Editor, (and the same technique works in the Log or Output windows as well), click File>Save As, or type
Command==> file '<UNIX filename>'
for example,
Command==> file '~/statclass/assignment3.output'
Of course, any path specified in a filename must already exist, and the file name itself (after the last slash) can be any valid UNIX file name that you choose. For example, the file name in the last example above might be the contents of the Output window in a session where the user was working on assignment #3 for her statistics class.
It is advised that you choose names that reflect the contents of the file, for easy retrieval later. You should also take care not to use already-existing file names; if you do, SAS will bring up a special window that notifies you there is already a file by the same name, and ask you what action you would like to take.
If you are making a file out of the Log or Output windows, you may wish to use the print command (with the file= option) instead of the file command. The file command writes out the contents of a window without carriage controls (page breaks), but the print command includes the carriage controls so that in subsequent printing, pages are printed separate from one another.
The print command without operands is normally used only when you have a printer physically connected to your machine. When the file= option is used, however, the result is a file that contains carriage controls for page breaks. The syntax for the print command with the file= option is
Command==> print file=<--file specification-->
for example,
Command==> print file=my.log
The default width for SAS output is 132 characters, which raises potential problems when viewing or printing the output file, since the default for most printers available from UNIX is 80 characters and many terminal screens also have a maximum width of 80. SAS does allow you to restrict the width of the output to less than 132 characters, as in
OPTIONS LINESIZE=80;
but if you still wish the default 132-character format, it is possible to print in that way at most UNIX printers.
Note that when you use smaller fonts, more lines can fit on a regular 8-1/2" x 11" page, so you may want to adjust the PAGESIZE option to avoid large blank spaces. For example, enscripted, landscape-rotated Courier9 prints about 55 lines by default. The default PAGESIZE in SAS under UNIX is 20 lines. To avoid 35 lines of blank space on each page, use the following option:
OPTIONS PAGESIZE = 55;
You can adjust both PAGESIZE and LINESIZE in conjunction with whatever font you choose, to maximize the use of the physical printed page.
To see a list of printers known to UNIX, type printers
at your UNIX prompt. The printer "code" will be shown
in the leftmost column.
To print a file on one of the UNIX printers, use the lpr
command with the -P switch, as in the following
example, which prints "my.file" to the printer
in UCC 101 (the UCC Distribution Area):
lpr -Pps_ucc101 my.file
NOTE: ps_ucc101 is used only as an example; this probably is
not the most convenient printer for most users.
Some printers are configured for PostScript only, and
will not accept text-file input from the
lpr command.
In this case the enscript
command (which converts text to PostScript)
should be used instead, as shown here:
enscript -Pps_ucc101 my.file
To print output that is more than 80 characters wide, many
printers will require that you rotate the orientation of the page
to "landscape" (the default usually
is "portrait") and often you
will also need to reduce the font size to get all 132 columns on
the page without wrapping. This can be accomplished with the
enscript command followed by the
-r (rotate) option and the -f
(font specification) option.
One font that has been tested for wide output is Courier9,
though others may work as well. The following will print
wide output (132 characters per line) without any wrapping or
truncation:
enscript -Pps_ucc101 -r -fCourier9 file.nameYou can also download your output (or any file) to a PC or Mac, and print on a local printer, if you prefer. The consultants have documentation on how to download files.
The DATA Step in SAS names the SAS Data Set that is being created (the DATA statement), tells SAS where the data may be found (the INFILE statement if the data are in an external file, or a CARDS statement if the data are instream), and describes the setup and format of the raw data (the INPUT statement).
A very simple DATA step (with data in an external file) might look like this:
data first;
infile '~/mydata/raw8.data';
input id 1-3 height 4-5 weight 7-8
age 10-11 sex $ 15;
data second;
input id 1-3 height 4-5 weight 7-9
age 11-12 sex $ 13;
cards;
00158 98 14F
00265 149 15M
00371 198 17M
00445 100 12F
and so forth
Occasionally, users have problems with the record length of raw data files used in SAS. The typical configuration for UNIX files is that each record ends immediately after the last character in the line. Consider the following:
14658
2346
33546
45342Lines 1, 3 and 4 are five characters long, while line 2 is four characters long. We'll call the raw data "raw.data" and ask the following SAS program to try to read it:
data temp; infile 'raw.data';
input a 1 b 2 c 3 d 4 e 5 ;
run;
While the value for E in observation 2 should be "." (missing), the end of line forces SAS to go to the next line, where it finds a "3" and assigns that to variable E for observation 2. All values from that point on are incorrect, and the SAS Data Set ends up with the wrong number of observations.
One solution to this problem is to force UNIX to "pad" each line with blanks up to a certain point so that all the lines are the same length. In the example above, if each line were extended to column 6, the problem would be solved. In other data files, you just need to choose a number that is longer than the longest existing line. The following SAS program can be run to create a new data file that SAS can read as intended.
data _null_;
infile 'raw.data';
file 'raw.data.fixed';
input; put @6 ' ' @1 _infile_;
run;
This program puts a real blank at column 6 in each line, then puts each line of the original infile beginning at column 1 of the same line. The result is a data file in which every line is 6 characters long, regardless of how many "real" characters are in the line.
DATA MYTEST3;
will begin a DATA step that will create the SAS Data Set WORK.MYTEST3. You may always refer to it simply as MYTEST3.
You may also choose to make any SAS Data Set permanent by using a two-level name in the DATA statement. The first level given by you overrides the WORK. default that SAS would have provided, and also serves as a "nickname" (SAS calls it a LIBREF) for the location in which the permanent data set is to be stored. LIBREFs are also used to point to the location where previously- saved SAS Data Sets are kept. This association between the nickname (LIBREF) and the location in the UNIX subdirectory structure or Windows or Macintosh Folder structure is set up with a LIBNAME statement which must appear before the two-level data set name appears.
LIBNAME statements have the following syntax:
libname <libref> '<subdirectory or folder location>';
where you choose the information inside the angle brackets. For example,
libname mysave '~/user3/sasdata'; /<-- UNIX example **/
libname mysave 'd:\user3\sasdata'; /<-- Windows example **/
libname mysave 'HardDisk:User3:SASdata'; /<-- Macintosh example **/
makes "mysave" the nickname for the subdirectory /user3/sasdata. Then, when either of the following statements appears,
data mysave.datarun2; <--further data step statements-->
proc means data=mysave.datarun1;
SAS uses "mysave" to point to /user3/sasdata, where the data set "datarun2" will be written, and where "datarun1" will already be located.
put _all_;
but this is definitely not recommended. The result of this technique cannot easily be described; try it some time, and you'll see why it should be avoided.
Unlike most SAS DATA steps, the DATA step used to write out raw data usually does not need to create and keep a SAS Data Set, so typically people will use a DATA _NULL_; statement. SAS also needs to know what file to put the raw data into, and this is specified by the FILE statement.
Suppose you have a SAS Data Set called MYTRY, which you created at some point earlier in your session. (You can also use SAS Data Sets saved permanently from previous sessions or jobs, by using a LIBNAME statement and a two-level name in the SET statement.) MYTRY has 100 observations, and ten variables called:
ID SEX AGE RACE TEST1 TEST2 HEIGHT WEIGHT IQ INCOME
Now, you want to create an ASCII (raw) file containing only three of those variables. This is how your program might look (the FILE statement example is for the UNIX environment; modify the external-file specifications accordingly for use on Windows or Macintosh files):
data _null_; set mytry;
file '~/rawinfo.dat';
put id test1 income;
run;
This will create (or overwrite) a file called rawinfo.dat in the home directory, and the file will contain all the values for ID, TEST1 and INCOME, separated from the other values by a single space.
Sometimes you have variables whose values aren't always the same number of digits or characters. In that case, the program above would output the values, but they would not line up. If you want values to be put in specific columns, regardless of their length, add column pointers (@n) to the PUT statement, as in the following example (the FILE statement example is for the UNIX environment; modify the external-file specifications accordingly for use on Windows or Macintosh files):
data _null_; set mytry;
file '~/rawinfo.dat';
put @1 id @10 test1 @20 income;
run;
data _null_; set mytry;
file '~/rawinfo.dat';
put id--income;
run;
SAS formats have the form xxx.yyy, where xxx is the name and sometimes length of the format, and yyy is the number of digits after a decimal. If there are no digits after a decimal, the format name/length ends with the period. For example, the SAS format for dollar amounts in the millions might be DOLLAR12.2, which would allow 12 characters (including the decimal), with the last two being after a decimal point. ROMAN10. would output values in 10 'digits' as Roman Numerals. SSN11. outputs social security numbers, such as 123-45-6789.
SAS also allows the use of formats for character variables.
These formats are similar to numeric formats, except that the
format names always begin with the dollar sign ($).
SAS Language allows users to assign their own formats to values in their data. Usually, this involves users asking SAS to replace numbers in their data with some kind of labels. The most common example is the user request that SAS take '1's and '2's in a variable called SEX and format those values as the words 'female' and 'male' when they are displayed in output.
original data output using user-defined format
----------------------------------------------------
1 female
2 male
2 male
1 female
2 male
Both SAS formats and user-defined formats can be assigned to variables in PROCs (which makes them apply only for the output of that PROC) or in the SAS Data Set (which causes the format to be used every time the value is used). This is true of both SAS formats and user-defined formats. The use of SAS formats is automatic, as all the internal SAS formats are kept in a library that is always available in every SAS job or session. The use of user-defined formats is a little more tricky, as the formats first must be created, then they must be made available to the SAS job or session that uses them. Here is a brief scenario:
Temporary user-defined formats (that will exist for the life of the job or session only) are created with a simple PROC FORMAT, as in the following example.
proc format;
value sexfmt 1='female' 2='male';
This creates a user-defined format called SEXFMT. (note that a period is placed at the end of the format name in all situations except the original VALUE statement where it was created). The use of 'FMT' is not required. This format could have been called ABCXYZ. if desired.
The format then can be used in a DATA step
data readin; input id gender;
format gender sexfmt.;
cards;
001 2
002 2
003 1
004 2
005 1
;
The format also could be used instead in a PROC step
proc print data=readin;
format gender sexfmt.;
1 male
2 male
3 female
4 male
5 female
proc format;
value $gender 'F'='female' 'M'='male';
This creates a user-defined format called $GENDER. (note that a period is placed at the end of the format name in all situations except the original VALUE statement where it was created). The format then can be used in a DATA step
data chartest; input id gendchar $;
format gendchar $gender.;
cards;
001 M
002 M
003 F
004 M
005 F
;
proc print data=readin;
format gendchar $gender.;
SUGGESTION: Assign user-defined formats in SAS data steps only when you are familiar with the use of permanent format libraries, and you intend to have yours available in every session or job. Otherwise, assign formats in PROC steps only when necessary.
To store formats in a permanent library, include the LIBRARY= option in the PROC FORMAT statement. As mentioned above, this requires a prior LIBNAME statement, as shown in this example.
libname library '~/sasfmts'; /* example for UNIX */
libname library 'C:\sasfmts'; /* example for DOS/Win */
libname library 'Hard_Disk:SASformats'; /* example for Mac */
proc format library=library;
value sexfmt 1='female'
2='male';SAS creates (or updates) a file in ~/sasfmts (or C:\sasfmts, or Hard_Disk:SASfmts:) called formats.sct01, which is the formats catalog. This file should not be deleted or edited.
Then, in a future job in which the formats are to be used, include the LIBNAME statement again. You may then refer to the user-defined formats that are in your library without further ado.
libname library '~/sasfmts'; /* example for UNIX */
libname library 'C:\sasfmts'; /* example for DOS/Win */
libname library 'Hard_Disk:SASfmts'; /* example for Mac */
proc print data=readin;
format gender sexfmt.;
SAS will find the format in the format library, and the output will contain the formatted values for GENDER, in place of the original numeric values.
SAS Views provide all the functionality and flexibility of SAS data sets, but occupy only a minuscule fraction of the space of a full SAS data set. This is accomplished by SAS compiling and storing the DATA step code that reads data from raw files or other SAS data sets, then executing that code whenever the View is referenced. The View acts as sort of a "map" to the source data, instead of making a complete copy of it in SAS data format. Execution of a View is a bit slower when compared with the use of a "real" SAS data set, but the difference is noticeable only on very large sets of data.
SAS Views can read SAS data sets on disk, and raw data stored on disk as well as on UniTree. (Using raw data stored on UniTree is discussed elsewhere in this document.) Basically, anything a DATA step can do a View can also do, using far less space to store the "results".
In one test, a regular SAS data set was created from a 2.5Mb raw data file on UNIX disk. Not all fields were read, resulting in a SAS data set of just under 800K. A SAS View also was created to read the same variables and provide the same information to SAS PROCs and other DATA steps. The View occupied 6144 bytes! In situations where raw data must reside on disk, including those situations where the raw data are continually updated, SAS Views can save space and allow access to the most recent version of raw data, without the need to create and store actual SAS data sets.
SAS Views are documented in the SAS OnlineDoc(tm), listed in References at the end of this document.
To create a SAS View, add the VIEW= option to the DATA statement. The SAS data view name provided after VIEW= must be the same as at least one of the SAS data set names mentioned in the DATA step statements, but may not be the same as a SAS View or SAS data set already in the same library. Virtually all the language of the DATA step is the same as it would be if a true SAS data set were being created, except that the VIEW= option is added. For example, the following statements read raw data and create a SAS View called view1.ssv01:
libname viewout '~/sasviews';
filename raw1 '~/rawdata/file1.raw';
data viewout.test1 / view=viewout.test1;
infile raw1; input var1 var2 var3; run;
libname viewout '~/sasviews';
filename raw1 '~/rawdata/file1.raw';
proc print data=viewout.test1;
libname allsas '~/sasdata';
libname viewstor '~/sasviews';
data viewstor.females / view=viewstor.females;
set allsas.master; if sex='f';
data viewstor.males / view=viewstor.males;
set allsas.master; if sex='m';
To process the two subsets in the example just above, the following might be used:
libname allsas '~/sasdata';
libname viewstor '~/sasviews';
proc means data=viewstor.females;
var <--variable list-->
proc reg data=viewstor.males;
model <--model specifications-->
run;
LIBNAME ALLSAS statement is needed to point to
the master SAS data set,
and the LIBNAME VIEWSTOR is needed to
point to the View. Of course, they could both be stored in the
same subdirectory if desired.Using SAS Views requires attention to some important details and warnings:
/tmp Space/tmp space, similar to
their own disk file quotas, so this may not solve SCF users' problems
completely. RCF users also have /tmp space quotas, and can request
increases from ITS as necessary.
The space is in a subdirectory called /tmp (and, on some
systems, /tmp1, and so forth;
enter ls -ld /tm* to see them all).
For descriptions and policies related to shared /tmp
space, scroll to Section 7 in the following page:
http://www.usc.edu/its/policies/procedures/
Anyone can write in the shared /tmp spaces, create subdirectories in
them, and in general manipulate files as you would in your home
directory.
You should be aware that files stored in /tmp are not
permanent, and will be deleted by the system on the regular
/tmp cleanup schedule. This schedule is different for different machines
and /tmp areas, but the bottom line is that your files will
go away.
/tmp) if they are used.
Users are urged to compress any files larger than 20 Mb if they
are not being used for long periods of time. The amount of time
it takes to compress or uncompress files is minuscule, and much
space will be saved by this operation.
To compress a file in UNIX, use 'compress'; to uncompress a
compressed file, use 'uncompress' or 'zcat'.
In the following examples we compress a file
called test1.bigfile, which results in a
compressed file called test1.bigfile.Z:
compress test1.bigfile
Either of these commands results in an uncompressed file:
uncompress test1.bigfile.Z
zcat test1.bigfile.Z > test1.bigfile
The 'zcat' command, shown above, normally is used for viewing files, but with the use of the redirect, can re-create files from their compressed versions. While the 'compress' and 'uncompress' commands use the previous names (with the addition or deletion of the .Z extension), 'zcat' can redirect the compressed file into an uncompressed file of any name.
/tmp space.
While any SAS working files can be directed to /tmp, as the
examples and explanations here show, it is usually not a good
idea to redirect the -sasuser subdirectories to /tmp, as they and
other temporary SAS work files will be deleted in due course.
The files in the -sasuser area are very small, and contain information
that many users wish to keep from session to session. For these
reasons, it is always better to keep the -sasuser directories and
files in your own file structure.
There are many ways to use /tmp in SAS, indeed almost as many
ways as you can use your own subdirectory structure. One example
is the use of a large file of raw data to create a SAS data set
that will be stored in your own file structure (your own
subdirectories). You might ftp the file containing the raw data
from another system to /tmp (or to a subdirectory that you create
in /tmp), then use the following SAS program to read it:
libname perm '~/sasdata';
filename indata '/tmp/mydir/raw.data';
data perm.project8; infile indata;
input <variable names and specifications>
This would leave the space available within your quota free of the large raw data set while SAS is creating and saving the permanent SAS data set.
One more way of managing limited working space is to ask SAS to clear it out whenever previously-created temporary SAS Data Sets are no longer needed. Some programs create a number of SAS Data Sets, one after the other, leading up to a "final" version that is the one to be used for analyses. All temporary SAS Data Sets, however, are kept in the working space until the end of the SAS session, or until the user asks SAS to delete them, whichever comes first. If you are running out of working space, and you have a number of DATA steps in your program, you can delete any unneeded SAS Data Sets with PROC DATASETS. At the end of the following example, only FINAL remains in the working area. Without the PROC DATASETS step, all four SAS Data Sets would still be saved in the working area.
data one; infile 'raw.data'; input id test1 test2 sex $;
data two; set one; if sex = 'f';
data three; set two; average = (test1 + test2) / 2;
data final; set three; if average gt 50;
proc datasets library = work; delete one two three;
run;
The first example shows how to access compressed raw data residing on UNIX disk. The PIPE keyword is used in the FILENAME statement, and the UNIX 'uncompress' command is placed inside the single quotes:
filename test1 pipe 'uncompress -c raw.file.Z';
data cmpress1;
infile test1;
input <--variable and format specifications-->
For further information on saving resources while using large amounts of data, see the section above entitled "Using Large Data Sets in the UNIX Environment".
/tmp for
workspace in the Student Computing Facility and /tmpsas0
in the Research Computing Facility.
(The /tmpsas0 space in the
RCF may be used only by SAS; users may not
use this space for any other purpose than for SAS's own
workspace.
User files stored in /tmpsas0 will be deleted without
notice.) Occasionally, these large, public-access work areas get
full and you may need to invoke SAS with an alternative work area
specified. You can direct SAS to use any space for its work area
that you have write access to. If you find that the default work
areas are temporarily full, and you wish to redirect the SAS work
space to the common user space called /tmp1,
for example, invoke SAS as follows:
sas -work /tmp1
and SAS will direct all its work files to /tmp1.
Note that you must specify alternative
workspace when you invoke SAS: workspace
cannot be transferred to another place during a SAS session.
Note also that if you use a workspace other than the default and
your SAS session ends abnormally, it is your responsibility to
make sure that any working files left behind are removed to free
the space for other users.
If you run out of space during a SAS job and need to estimate
whether your job will run if you invoke SAS and specify another
directory, first determine how much space is available in the
directory (go to the directory and type df . -- that's
"df" followed by a space, then a period), then look at the
size of the SAS or raw data file you wish to manipulate (this can
be done several ways, including the lf -l command). If there
is free space equal to twice the size of your file, it should be
sufficient, unless you are planning to do a sort, in which case
you should have at least three times the size of the file in free
space available.
There are several useful techniques for dealing with large jobs that take a lot of time. You can run your jobs in batch mode, rather than interactive. This avoids using any memory that would be necessary for interactive mode. You can run your batch job in the background (by placing an ampersand [&] at the end of the command-line invocation), which allows you to logout while the job finishes, if you wish. (Running a job in the background also allows you to avoid timeout problems associated with long periods of terminal inactivity when you are connected via a micom line or modem.) And you can queue your job to run at a later time, when the system is likely not to be so busy.
sas command followed by the name of that file.
(The names of SAS programs run in this manner traditionally have
the file extension .sas.)
SAS runs your program and creates two files for your use, one
containing the SAS Log and the other containing any output. If
you used the filename in the example above, these files would be
called myprogram.log
and myprogram.lst, respectively.
To run this batch program in the background, simply put an ampersand (&) after the file specification:
sas myprogram.sas &
When you have done this, you can perform other tasks in the foreground, and if you wish, you can logout and your job will continue to completion.
at
and qsub Commands
www.usc.edu/hpcc/systems/use-l-4.php
To queue your job to run at a later time, you can use the at
UNIX command. This requires that you place your invocation command and
all other specifications (such as the filename of the program and
any options or switches) into an executable shellscript file, and
then specify the executable in an at
command, such as
at 2:30a < execthis
where execthis is an executable shellscript you have created.
(Of course, the name execthis is arbitrary, and can be any
filename you choose.)
Let's say you have a statistics package called THYSTAT
(for those who take documentation literally, note that this
is a mythical package name, for illustration only), and
your THYSTAT program is contained in myprog.thystat1
which you keep in your home directory (~/) in a subdirectory
called programs.
Part of the peculiar syntax of THYSTAT is that before the
batch file name, you use a switch spelled -in.
For whatever reason, you wish to run your program late at night.
To make an executable shellscript to run your batch program, enter the
following into a file called execthis :
#!/bin/sh -f
thystat -in ~/programs/myprog.thystat1
chmod u+x execthis
You can then run the at command, as shown above, and specify
any time you feel would be best to run your job. For more
details on the at and chmod commands, see the man pages or
call the consultants.
qsub Command and the PBS System qsub command,
which sends a request to the Portable Batch System (PBS).
RCF users normally can use the qsub command
automatically.
If it is not immediately available, run
source /usr/usc/pbs/default/setup.csh man pbs and
man qsub for complete online help
information.
Another helpful man page is man pbs_resources_linux
which details the resource options (e.g., walltime, cput [cpu time],
etc.) available for the qsub command.
The qsub command itself runs a script file, and
inside the script file is the batch invocation of the software
you wish to run (along with any other appropriate UNIX commands.
qsub also writes to a LOG file that you specify,
so you can see the STDIN and STDOUT messages associated with the
running of your queued job. The general form of the qsub
command is
qsub <flags> SCRIPTFILE
Once again, as in the example above,
let's say you have a statistics package called THYSTAT
(this is just a mythical example, to be substituted with
whatever real command name and syntax you want to queue)
and your THYSTAT program is contained
in myprog.thystat1
which you keep in your home directory (~/) in a subdirectory
called programs.
Part of the peculiar syntax of THYSTAT, let's say, is that before the
batch file name, you use a switch spelled -in.
Normally, you would run it in batch as follows:
thystat -in ~/programs/myprog.thystat1
In order to queue it with qsub and have the system
run it later, you would create a qsub-appropriate SCRIPTFILE
containing at least one line with a pound symbol ( # )
followed by the invocation of your software program, as shown
above. Let's say you decide to put this into a file called
my.qsub.script.
The contents of that file would be
#!/bin/csh -- a line beginning with # must begin the script file
thystat -in ~/programs/myprog.thystat1
(Once again, remember that thystat is a bogus
name, for example purposes only, and needs to be substituted
with a real command name and syntax of your choice.)
The following command would queue your THYSTAT program for execution at a later time chosen by the system.
qsub -m be -k eo my.qsub.script
where -m be asks NQS to broadcast a message (i.e., to tell you)
when the request ends execution; -k eo
tells qsub to keep the STDERR and STDOUT output.
A number of other flags are available, as listed in man qsub
(remember to source the pbs setup file as shown above).
Many flags can be incorporated into the script file itself.
For example, if you want your program always to report the
results to your home directory, the -k eo flag may be
entered into the file.
Also, directions as to how much time to allow (walltime),
how many nodes to use (nodes), and how many processors
to use (ppn).
If you want your job to run on the main rcf-01 processors,
you can specify that in a separate nodes instruction
(as shown in the example).
Following is a sample (and simple!)
script file that includes these requests. (The ls
command is used as an example of a simple program that returns
a detailed listing of the files in your home directory.)
#!/bin/csh -- any text here
#PBS -k eo
#PBS -l walltime=2:00:00
#PBS -l nodes=rcf-01
#PBS -l nodes=1:ppn=1
# run the program
ls -la ~/
exit
IMPORTANT NOTES:
nodes= must always be 1 when submitting
jobs to rcf-01, as the facility is configured as a single node.
/export and /auto
must not be used.
Instead, use the form /home/rcf-nn/username, where
nn is the number of the file system partition where
the files are stored, and username is
the username of the home directory where the files are stored.
qsub
command will execute within a few minutes,
though in some cases it could be delayed until the system is relatively
unbusy at night.
SAS provides two Point-and-Click environments for performing analysis using many of the PROCedures. These interfaces make it unnecessary in many cases to write SAS code at all, though using them correctly requires a full understanding of how SAS stores and retrieves data (SAS Data Sets, Libraries, etc.).
The Analyst Application is available with Version 6.12 and higher. In the UNIX environment, it requires an X-Windowing interface. The Analyst Application provides a very user-friendly and intuitive (for those familiar with statistics) point-and-click environment for analysis and graphing of data that have been stored previously in a SAS data set. Analyst does not provide an interface for importing data or reading raw data from flat files. Data must be imported or read in by other methods before using the Analyst Application.
The Analyst Application is documented in a SAS publication that is listed at the end of this document. For more information, including a link to the SAS WWWeb site that discusses Analyst, visit:
http://www.usc.edu/its/doc/statistics/sas/faq/analystapp.shtml
To invoke the Analyst Application click on
Solutions>Analysis>Analyst,
or type analyst at any command line.
After generating an analysis or graph using the Analyst Application,
you can go to the Program Editor and click (or type)
recall to see the program that SAS used (actual SAS
code) to perform the analysis you requested.
If you wish, you can then save the program to a file for later use.
Enterprise Guide is the newest point-and-click environment available for SAS. It performs analyses as well as data reading and data manipulation. (Note that this software is not available on the Macintosh.) Enterprise Guide is distributed with the ITS version of SAS for Windows, but must be installed separately. Once installed, it will appear in the Programs choice of the Windows Start menu, and if you choose, SAS will create an icon for your desktop. The online instructions and Help system in the Enterprise Guide make it self-explanatory, and it is fully documented in a SAS publication listed at the end of this document.
SAS/ASSIST is an older interface that is not quite as user-friendly as the Analyst Application or Enterprise Guide. It does have the ability to create SAS data sets from raw data, as well as do many of the analyses normally available from SAS PROCs, but with the other two more recent point-and-click choices available, it may never be necessary to use this older interface.
help at a Command Line.
http://www.usc.edu/its/doc/statistics/sas/sasgraph/
If you are running SAS under X-Windows on a Sun workstation or
on a PC or Macintosh
running X-windowing software, SAS should display any graphs
you generate without requiring you to enter a
DEVICE= specification.
Contact the consultants (see the end of this document) for more
information about X-Windowing software that runs on a
PC or Macintosh.
Printing graphs from SAS is done in two ways: sending the graph
directly to a printer or routing the graph to a graphics stream
file (GSF) which is then sent to the printer via an lpr command.
The printers command at the UNIX prompt will show a list of
printers known to your system, to which you can print graphs
directly or send the GSFs via the lpr command.
(Of course,
GSFs also can be transferred to machines other than your system
which may have access to printers more convenient to you.) The
examples given here will show how to make a graph appropriate for
a PostScript printer, though there are many alternatives, as SAS
can output graphs to most printers on the market. The list of
printers shown by the
printers command designates PostScript
printers by starting the printer name with
ps_, such as
ps_ucc101, which will be used in the examples below.
To determine the appropriate graphics driver in SAS for the printer or plotter on which you will be printing or displaying your graph, invoke interactive SAS and submit the PROC GDEVICE statement. This will bring up a special window in which all drivers available in SAS are listed, along with a short description of the corresponding printer or plotter. You can scroll up or down and find the description and driver name that most closely matches your output hardware. This window includes drivers that have been customized by ITS for use with PostScript printers. (A list of the drivers customized by ITS is provided below.)
The following is a partial list of the GOPTIONS parameters that may be used in producing a graph from SAS under UNIX. Please note that there are many alternative ways in SAS to perform these same tasks, and what are presented here are only samples to get you started. For a complete discussion of these, and other, GOPTIONS see the relevant SAS manuals. (Some of these options are used for all graphs, some just for directly-printed ones, and some just for GSFs. The appropriate options are shown in the examples below.)
RESET=ALL
(resets previous goptions settings; this must be first)
DEVICE=devicename
(PostScript devices include PS, PSL, and so forth;
see the SAS/GRAPH manual for a more complete list, or
run PROC GDEVICE for the most complete list; ITS has
added some customized drivers for various sizes of
PostScript output; these drivers are PSUSCSM, PSUSCLG,
and PSUSCMAX: see below for details on these drivers)
GSFNAME=fileref
("fileref" is the nickname specified in the FILENAME
statement; this is used for GSFs)
GPROLOG='25210D0A'x
(this may be necessary to initialize Post Script printers
with the usual %!
characters; use this option only with PostScript output,
and only if the driver doesn't already supply it)
GSFLEN=80
(length of the GSF file's records; value may also be 132 when
graphs are being sent directly to a printer)
GSFMODE=REPLACE
(to replace previous graphs in the GSF; other options are
APPEND and PORT)
NOPROMPT
(this suppresses prompts that ask you to turn on a printer,
and so forth; if you see such a prompt, hit return)
To print a graph directly from SAS to a printer, first identify a
printer that is known to your machine (by using the printers
command) and convenient to you, note the name, and type it in the
program in the appropriate place.
One example is shown in (1)
below, using the ITS PostScript printer named ps_ucc101.
To create a file containing a graph that will be sent to a printer at a later time, code the proper statements and options for a Graphics Stream File (GSF). GSFs are files created by SAS using the driver appropriate for the printer which will ultimately receive the graph. To make a GSF that will print on a PostScript printer, you will need to use a FILENAME statement to set up the file to receive the GSF, and several GOPTIONS statements, as shown in example (2) below.
After the FILENAME and/or GOPTIONS statements, the graph can be
created as usual. If you are reading raw data before issuing the
graphics PROC, you will need a DATA step. If you are running the
graphics PROC against a SAS data set previously saved, you will
only need the graphics PROC with a DATA= option. In the examples
below, it is assumed you have your data in a SAS data set called
sasdata.plot14.
Example (1) -- Printing a Graph Directly to a Printer
filename mygraph pipe 'lpr -Pps_ucc101';
goptions reset=all device=psuscsm gsfmode=replace
gsfname=mygraph gsflen=80 noprompt;
proc gplot data=sasdata.plot14; plot var1*var2; run;
Example (2) -- Creating a Graphics Stream File for Later Printing
filename graph8 '~/sasprogs/graph1.ps';
goptions reset=all device=psuscsm gsfname=graph8
gsflen=80 gsfmode=replace noprompt;
proc gplot data=sasdata.plot14; plot var1*var2; run;
SAS sometimes behaves unpredictably when users alternate between color and monochrome graphs using the same SAS program, with different drivers plugged in. What was to be a dotted line will appear as such in a monochrome graph, but when a color terminal or plotter is used, the line may appear solid. This is because of a complex hierarchical default system regarding patterns, colors and such. To be sure that the graph will appear as you intended, you should specify all colors, patterns and other parameters explicitly, rather than leaving anything to SAS's defaults. Defaults will usually not disappoint you, but if you begin getting results other than what you expected, the solution often is to be explicit about every setting.
To send your graphs to a PostScript printer, you will need to
create a graphics stream file (see above) and you must set the
DEVICE= option to an appropriate driver. ITS has drivers
specially modified for standard PostScript printers or, if you
wish, you may create or modify your own graphics driver. (See
the SAS documentation for details on modifying or creating graphics device
drivers.) In addition, you may need to ftp your graphics stream
file to a system that knows about the printer you wish to use).
To see a list of printers known to a particular system, type
printers at that system prompt.
The drivers customized at USC for PostScript printers are:
driver max size printername
--------------------------------------------------------
PSUSCSM 7.5"x10" (various; e.g., ps_ucc101)
PSUSCLG 11"x17" (must use Graphics Stream File)
PSUSCMAX 34"x100" (must use Graphics Stream File)
GSFMODE=REPLACE, GSFLEN=80, and
GPROLOG='25210D0A'x.
ps_ucc101,
and is known to all systems. To see a
list of other printers known to the system where your SAS
program generated the graphics stream file (GSF), type
printers at the system prompt. If the printer you want
isn't in that list, ftp the GSF to a system that knows your
chosen printer, and lpr the file from there.
HSIZE= and/or VSIZE=
parameters in a GOPTIONS statement), you have a number of
alternatives. You can make the VSIZE smaller than the HSIZE,
in which case your graph will appear to be landscape. You
can actually change the orientation by specifying
ROTATE=LANDSCAPE, in which case your graph will be rotated 90
degrees from what it would have been without the
ROTATE=
option, within whatever size dimensions are in effect at the
time. Note that
ROTATE= LANDSCAPE will not always result in
a truly "landscape" graph.
It depends on the dimensions
being used. The rule of thumb is to first imagine your graph
in the given (max) dimensions, with the width (34") being the
bottom of the graph. Then change the dimensions (and/or
rotate the graph with
ROTATE=LANDSCAPE) to make your graph
appear in the proper aspect and the desired size.
Call the office or business which will be printing your graph, tell them you will have a graph encoded in PostScript, and ask what kind of file or diskette they will require. When you learn this information, you will then be able to download your file to a diskette, or transport it using the method that your printer requires.
The example below shows all the elements needed to make a
graphics stream file using one of the USC-modified drivers (in
this example, PSUSCSM). The GOPTIONS statement is typical, and
the
RESET=, DEVICE= and
NOPROMPT parameters should always be
included. The GSFNAME=
parameter must match the FILEREF on the
FILENAME statement (in this example GRAFOUT), and the optional
BORDER parameter puts a box around the graph. The optional
HSIZE= and
VSIZE= parameters resize the graph within the maxima
(which are 7.5" and 10",
respectively, for this particular driver).
filename grafout 'test1.graph';
goptions reset=all device=psusclg gsfname=grafout
hsize=6 vsize=9 border noprompt;
data temp; input a b;
cards;
56 87
56 89
57 89
57 90
57 91
58 92
68 94
79 98
;
title1 f=duplex c=green 'This is my test graph';
symbol1 c=red i=join v=star;
proc gplot; plot a*b;
run;
-P switch.
For example, if you have prepared
a graphics stream file (GSF) called graph.test
you can send it
to the ps_ucc101 printer as follows:
lpr -Pps_ucc101 graph.test
Mapping in SAS/GRAPH is available through PROC GMAP, which allows you to use already-prepared map files for most areas of the world. Map files for the United States and Canada contain detail down to the county (or equivalent) level. Map files are stored in a read-only directory.
To see the maps that are available, type
ls /usr/usc/sas/default/maps
Each map file has a descriptive name, followed by
.sas7bdat (which
indicates that it is a SAS data set generated with a 7.00 or
higher engine).
For example, one map of El Salvador is named
salvador.sas7bdat
The following example outlines the necessary SAS program statements for using a map file (the libref "maplib" is arbitrary):
libname maplib '/usr/usc/sas/default/maps';
proc gmap data=<your sas data set> map=maplib.salvador;
SAS/INSIGHT runs only under OpenWindows (X-Windows) or in the microcomputer versions (Windows and Macintosh), and is invoked by typing "insight" on the Program Editor command line, or by submitting the following program:
proc insight;
run;
The Statistics Consultant gives short demonstrations of SAS/INSIGHT in the regular SAS Under UNIX class offered upon request (213.740.5555).
This section will give simple examples of two types of Macros: those that don't use macro variables, and those that do. The SAS Macro language and operation is documented fully in the Reference on macros shown at the end of this document.
Example 1: a simple macro
Say you are going to create ten different SAS data sets, each with the same variables but different data, and you want to print the same group of six variables after each data step completes. You can write the PROC PRINT and associated statements ten times, or you can write it once into a macro, then call the macro after each data step.
%macro print1;
proc print; var id height weight age iq birthyr;
run;
%mend print1;
data one; set master; if birthyr=1946;
%print1
data two; set master; if birthyr=1950;
%print1
data three; set master; if birthyr=1955;
%print1
(etc.)
Example 2: macros that use symbolic variables
Macros can be made even more flexible by the use of symbolic variables, which SAS calls "macro variables". In the example above, each DATA step has one value that changes, while the rest of the SAS language (including the macro %print1) stays the same. We can make that changing value (which is the value for BIRTHYR) into a macro variable, include the DATA step as well as the PROC PRINT in the macro itself, and then tell SAS which value of the macro variable to use each time it executes. The macro (symbolic) variable name is specified in parentheses after the name of the macro, then each time the macro is called the actual value to be used is specified.
%macro dataread(year);
data temp; set master; if birthyr=&year;
proc print; var id height weight age iq birthyr;
run;
%mend dataread;
%dataread(1946)
%dataread(1950)
%dataread(1955)
(etc.)
SAS/IML provides the capability of full matrix-algebra programming. To begin IML, submit the following statements in interactive SAS:
proc iml; run;
SAS/AF provides the ability to build menu-driven interfaces completely to the specifications of the user. SAS/AF is the basis for SAS/FSP and many other window interfaces that the SAS system itself uses. Having this software allows the user to write code to describe and customize every aspect of a menu and/or window interface.
SAS/OR software provides two groups of procedures used in the general area of Operations Research: project management and mathematical programming. These tools are directed toward the solution of management problems. They allow the exploration of models of distribution networks, production systems, resource allocation problems and scheduling questions.
SAS/QC software is avilable under UNIX for applications involving research design and improvement. QC (Quality Control) is an integrated set of tools used to assess and implement statistical quality improvement. The tools include PROCs, macros, menus and graphics in the areas of design of experiments, statistical process control, process capability analysis and sampling plan evaluation.
A complete set of examples of most SAS transport scenarios that involve the systems supported at ITS is available in:
www.usc.edu/its/doc/statistics/sas/sastransport/
www.usc.edu/its/doc/statistics/sas/faq/
http://www.usc.edu/its/doc/statistics/policies/The pertient section there is "Tape and Other Media Transfers".
For other tape formats or non-tape media, or in any situation where users are willing to pay the ITS file-transfer charges, they may take their tapes (or other media) to the Consultants and request that files be moved from tape (or other media) to disk (for use in SAS sessions or programs) or from disk to tape (after being used or generated in SAS).
Data that may be stored on, or used from, tape include raw data, SAS programs and SAS transport files (i.e., SAS data data sets in transport format), but not actual SAS data sets.
For help in copying files from tape to UNIX disk, contact the UNIX consultants (see the last page of this document). There is a nominal charge for each tape that is mounted and processed by the consultants (unless special handling is required, which is charged at a higher rate). Users will need to take the tapes to the ITS Customer Support Center (LVL Lower Commons) and will need to provide the consultant with all pertinent information, including the tape name or number, the number of files on the tape, the label type (if any) of the tape, and the record length, block size, record format and encoding language (e.g., ASCII, EBCDIC) of the files on the tape. For information on tape-handling (and other media), visit the Statistics Help Page on the Web:
http://www.usc.edu/its/doc/statistics/
Current schedules for User Services Classes (also called "Hands-On Workshops") are listed on the Web at:
http://www.usc.edu/libraries/adventures/Any Statistics Software class can be taught when groups of five or more users request them. Other ITS Classes by special arrangement may require a minimum of 10 attendees. Classrooms must be arranged by those requesting the class. Contact the User Services office for details, or visit
www.usc.edu/its/doc/statistics/help/classes/requests.shtml
cd) to
/usr/usc/sas/default/samples.
There you will see subdirectories
for the major packages within SAS. Choose the directory you
want, then cd to it,
and you will be able to list (ls) the sample
programs therein. Each file contains a different program. When
you choose the program you want, make a note of the name of it,
then go back to your directory structure, invoke SAS,
include the sample program, and submit it.
(In some samples you will
need to modify them slightly, so read the comments at the top of
the file carefully.)
Let's say, for example, that you wanted to run a sample that
demonstrates cluster analysis. When you go to
/usr/usc/sas/default/samples,
you will see the subdirectory
"stat". (CLUSTER is a PROCedure in SAS/STAT.)
When you cd to the
"stat" subdirectory, you will see several
files that begin with "clust".
Let's say you choose "clustex3.sas". Make a note of
it, then go back to your own directory and invoke SAS. When you
get into the Program Editor, type
include /usr/usc/sas/default/samples/stat/clustex3.sas
at the command line. Read the comments at the top of the file. If no modifications are indicated, then simply submit the program as you would any other. The results will go to your output window, as usual.
The most complete library of SAS sample programs is found at the SAS WWWeb site:
support.sas.com/techsup/sample/sample_library.html
endsas or bye
on the command line of any window.
If you are in X-Windows SAS, you can click the File menu,
then Exit, or click on the SAS Manager icon (probably
at the bottom of your screen), and then choose Terminate.
ps -ugx
ps command on various systems may need options
different from -ugx to get the desired results;
check with the consultants if you have questions.)
This shows a list of your processes, like the one below (some
columns have been left out to save space):
USER PID %CPU STAT START TIME COMMAND
janedoe 6393 7.9 R 18:05 0:00 ps -ugx
janedoe 6256 0.0 IW Sep 2 0:02 -csh (csh)
janedoe 4659 0.4 S Jan 3 210:00 /usr/usc/sas-6.11/sas
If you see something under COMMAND that has SAS in it, this means
a process involving SAS has been running for the amount of time
under TIME. If you don't want any SAS processes to be running,
you should kill the process by issuing the following command:
kill -9 4659
which "kills" process number 4659. Please check your processes daily to guard against overuse of the machine by unintended processes. This is a courtesy to other users, besides being in your best interests.
Problems With profile.sas7bcat
First of all, whenever customizing a profile (e.g., resetting Keys
to do special things, resizing windows, etc.), make a backup of the
profile.sas7bcat file in case your new version gets
corrupted.
This can be done as follows (examples are for Version 9 of SAS):
cd ~/sasuser.900
cp profile.sas7bcat profile.current
cd ~/sasuser.900
cp profile.current profile.sas7bcat
profile.sas7bcat file, and SAS will create a
new one the next time you launch SAS:
cd ~/sasuser.900
rm profile.sas7bcat
http://www.usc.edu/its/doc/statistics/sas/
As of Version 9 of SAS, full documentation for most parts of the SAS System can be accessed through the Help menu inside SAS.
SAS® is a trademark of the SAS Institute, Inc., Cary NC, U.S.A.
Some phrases used to describe SAS operations and features are freely paraphrased from SAS documentation.
Consulting. The ITS Consultants may be familiar with the language and general operations of this software, but it may be necessary to make an appointment with a member of the full time staff in order to receive detailed help. Support of statistics software is the responsibility of the ITS Statistics Consultant with the participation of other full-time ITS staff. These people may be contacted through the ITS Customer Support Center as shown here.
Customer Support. USC students, staff or faculty who would like information about ITS Workshops or about obtaining site-licensed software or other computing-related questions should visit the Customer Support Center in Leavey Library Lower Commons, or call 213.740.5555, or send eMail to <consult@usc.edu>
Documentation. This document, and many others on a variety of topics, are available in the ITS Customer Support Help System, available on the World Wide Web at:
http://www.usc.edu/its/
You can find Statistics Software Help Documents through the search engine at this same URL, or go directly to them at:
http://www.usc.edu/its/doc/statistics/help/
Newsgroups. Another source of information, this one providing the opportunity to exchange thoughts with other users, is the newsgroup 'usc.comp.all.stat.users'. For more information about reading news, subscribing to newsgroups, and related topics, visit
http://www.usc.edu/its/doc/internet/news/