|
SAS in interactive mode on UMDD SAS in interactive mode on UMDDThis is the default mode. At the CMS "Ready" prompt, type simply "SAS". SAS Display Manager will show two windows - the LOG and PGM (Program Editor) windows. Place the cursor at line marked 00001 in PGM, enter the following prog: data;
input x y z;
cards;
2 5 4
4 7 5
4 5 7
8 6 8
4 5 2
proc corr;
proc reg;
model z = x y;
run;
Along the "Command ===>" line at the top of the PGM window, you can type any command listed below. Notations regarding these commands are on the right. command ===> log Switch to the Log window
command ===> out Switch to the Output window
command ===> submit Run the SAS program in the PGM
command ===> recall Bring back the SAS program just
submitted
command ===> file 'Fn Ft a' Save the text in the window into
the permanent CMS file 'Fn Ft a'
command ===> include 'Fn Ft a' Bring the permanent CMS file
'Fn Ft a' into PGM window
command ===> endsas Terminate the SAS interactive
session
In Interactive Mode, SAS offers access to a SAS on-line help file for SAS language. Type "help" on the command line of any windows will open the SAS Help window. Type "help" on the command line of the Help window will display more instructions on how you can use this extensive on-line SAS Help facility. SAS in non-interactive mode on UMDD
sas regr The log and output generated by this run will be automatically sent respectively to permanent files REGR SASLOG A and REGR LISTING A. Errors often result in no LISTING output produced. You should always check your SASLOG for error and warning messages. SAS reading an external data fileIt is often more convenient to keep data in a separate file rather than including it in a SAS program. Suppose that the data is in the CMS file named REGR DATA A, a FILENAME statement will be needed to associate it with a file reference used in the INFILE statement: filename in1 disk 'regr data a';
data regfile;
infile in1;
input x y z;
proc print;
in1 could be any valid SAS name not used anywhere else in your SAS program. Saving a SAS datasetThe following SAS program reads the data from the file REGR DATA A and save a SAS dataset in REGR SASET A: filename in disk 'regr data a';
data saset.regr;
infile in;
input x y z;
proc print;
Note that a two part name SASET.REGR is used in the DATA statement. After a successful run of the above program, the CMS file REGR SASET A is created in the permanent disk 'A'. This permanent SAS data set contains all the data in the file REGR DATA A, including names and formats associated with the variables. When REGR SASET A is read back in by the SET subcommand or DATA option in other SAS programs, variables names and formats need not be re-identified. Reading a SAS datasetThese are two sample SAS programs using SET and DATA reaching
the data saved in the SAS dataset REGR SASET A: data regfile;
set saset.regr;
proc print;
proc print data = saset.regr; SAS librariesSAS groups SAS files into SAS data libraries. Under CMS, this
grouping is done by file type and file mode. Files with the same
CMS file type are members of the same SAS data library if they
are on the same minidisk or tape. Printing a saslog or listingAfter running SAS, you may wish to send the statistics output or the log to a printer. The CMS PRINT command sends a file to the IBM 3800 laser printer in A.V. Williams. To print the REGR LISTING A, at the "Ready" prompt, type: print regr listing a To print the REGR SASLOG A, type: print regr saslog a(cc The option cc instructs the PRINT command that REGR SASLOG A does not have the filetype reserved for a print file, but it is a print file, with a print control character at the beginning of each line. Printing a SAS graphTo print a SAS graph, you need to save the SAS graph as a script file by these SAS statements: goptions device=ps300 nodisplay gsfmode=replace gsfname=scrip;
filename scrip disk 'INCOMPIE PS A';
(SAS statements to generate the graph here)
run;
The postscript file INCOMPIE PS A can be either sent to a printer by the CMS NETPRINT command: netprint (network printer name) incompie ps a or just FTPed to a diskette and be printed later with appropriate DOS commands (COPY, PRINT, NPRINT etc.)
Writing a SAS transport format fileUse SAS portable files if you are transporting files between
different computers such as between UMDD and UNIX, between UMDD
and PC. data in1;
set set.file1;
libname out1 xport 'file1 xport a';
proc copy in=in1 out=out1;
select in1;
run;
where set.file1 is the sas data set of CMS name 'file1 set
a' and 'file1 xport a' is the CMS filename of the transport file.
Writing a SAS transport tapeUse tapes to store SAS portable files if you are transporting
huge files between different installations. cms mount pxxxxx as tap1(unl den xxxx ring;
cms tape rew;
cms filedef tapeout tap1(recfm fb lrecl 80 blksize 8000;
cms filedef in1 disk Fn Ft Fm;
libname tapeout xport;
proc copy in=in1 out=tapeout export;
run;
where pxxxxx is the tape number obtained when you register
your tape,
Reading a SAS transport format fileThe following SAS program can be used on most computer systems to read a SAS transport format file: libname trans xport 'XXXXX';
libname outlib 'YYYYY';
proc copy in=trans out=outlib;
run;
XXXXX should be replaced by the external filename of the transport
format file on the receiving host, On a PC or UNIX system, transmog reblock Fn Ft Fm newFn newFt Fm (lrecl 80
SAS reading a SPSS system file
filename in1 'spss syst a';
proc convert spss=in1 out=frspssys.saset;
proc contents data=frspssys.saset;
More memory to run SASSome SAS runs require more memory than others. To increase the memory, type:
define storage Xm
ipl cms
X is a number between 4 and up to the maximum memory allowed
to your account. macct listall or if your account is a subaccount then type: uacct list For SAS runs that need more than the maximum memory allowed to an account, users should contact the Statistics Laboratory 301-405-6030. The Lab will determine how much memory will be necessary for your SAS runs.
More disk space to run SAS
erase Fn Ft a If SAS still needs more space and you cannot erase any more
files on your A disk, contact the Statistics Laboratory at 301-405-6030
to determine how much more space is needed, or if the use of
a temporary disk will resolve the space problem. tdisk Fm size Fm is the disk mode of the temporary disk, this should be
a letter not in use - type Q SEARCH to see what letters are being
used size is the size in cylinders of the temporary disk requested.
tdisk C 50
sas regr (siodisk=c
If you create a temporary disk and then use the DEFINE STORAGE command discussed earlier, you will lose access to the temporary disk. To regain access, you have to use the ACCESS command: access diskaddr c where diskaddr is the disk address of the temporary disk. You can find this disk address by using the querry command: Q DASD It is better to use DEFINE STORAGE before you create a temporary disk. |
Updated 7/2/2001. Please send questions and comments to statlab@umail.umd.edu