SAS for Windows
Running SAS for Windows
- To start SAS: double-click on The SAS
System for Windows Icon
in the Applications folder or on any SAS data
(*.sd2) or program file (*.sas) from My Computer.
- To run programs:
- type in commands in the Program Editor window (for help with SAS command syntax, see help page on SAS Basics)
- click on Locals/Submit or the
SUBMIT icon on the Toolbox menu
bar. - To exit SAS: click on File/Exit or type bye in the Toolbox command line box.
- To stop SAS in process: Press the CTRL and PAUSE/BREAK keys simultaneously. You will be prompted for appropriate action (to continue or to halt SAS processing).
Menus
Three types of menus are available in SAS for Windows, with overlapping task functions.
- SAS Application Workspace Menu
(AWS):
Text Menu forming the top bar with pull-down menu items. - Toolbox
Icon menu bar that includes a command line box on the left and icons for different functions on the right.
Note: the check to the left of the command line box is for a carriage return (CR), used after a command has been typed into the command line box.Some of the icons and corresponding functions available from the menu bar:
to Submit program lines in the
Program Editor Window
to Open a New file in the
current window
to Open and to Display the
contents of an existing file in the current window
to Save (and replace) the
current window as a file
to Print the contents of the
current window
to Print Preview
to Cut highlighted portions of
the current window
to Copy highlighted portions of
the current window to the clipboard
to Paste the contents of the
clipboard to the current window
to Undo the last command
to invoke SAS Help - Pop-up Menu
Click on the right mouse button in any current window. The pop-up menu provides commands applicable to each window.
Useful Function Keys
<F9> keys , displays action of function keys
<F8> submit, applicable only to Program Editor window
<F4> recall text, applicable only to Program Editor window
<CTRL> E clear, clears text in current window
<F7> output, to view contents of Output window
<F5> program, to view contents of Program Editor window
<F6> log, to view contents of Log window
Printing Text
- Make the window from which you want to print the current window (click anywhere in the window)
- Click on File/Print, or click on the
Printer icon
on
the Toolbox menu bar. - Edit the file before printing outside SAS:
Click on File/Save (or Save As) to save the contents of a window and use an editor such as PFE to cut out unnecessary blocks.
Print selected sections from the editor.
Graphs
Using any procedure in the SAS/GRAPH module will invoke a separate graph window
- Click on File/Print or the Printer
icon
from the graph
window.
Reading in SAS Transport Files
To read and run a procedure using a TRANSPORT file (.exp file) created by SAS, enter the following in the Program Editor window in SAS for Windows:
libname in xport 'a:\diss.exp'; proc (whatever) data=in.diss; run;Where 'a:\diss.exp' is the Transport file name.
To make transformations and a new copy of the TRANSPORT file in PC SAS format:
libname in xport 'a:\diss.exp'; libname out 'c:\temp'; data out.diss; set in.diss; (data transformations, etc go here); run;These examples assume that the TRANSPORT file (diss.exp) resides on diskette in the 'a:' drive. If it resides elsewhere, you would have to make the appropriate path change. The second job would write the new dataset out to the 'c:\temp' drive. The file will have the name 'diss.sd2'.
Reading in Data Generated by Different Software
The software package DBMSCOPY available on all STATLAB machines can easily convert many types of non-SAS datafiles. Below are directions and links to access commonly used non-SAS datafiles.
- SPSS for Windows:
Portable datafiles from SPSS for Windows can be directly used in SAS for Windows.
Simply specify a separate library reference with the SPSS engine:LIBNAME in SPSS 'SPSS_portable_datafile_name_and_path' ;
- Spreadsheets: SAS can import data from
EXCEL spreadsheet and DBASE files through the Import/Export Wizard.
NOTE: EXCEL files must be saved as WORKSHEETS (not workbooks).
- Click on File/Import to call the Import Wizard.
- Click on the arrow to choose the file type.
- Navigate among the dialogue boxes using the Next > and < Back keys.
- You will be prompted for the location and name of the input data file.
- You will also be prompted for an output file library and name. The library list will include any libraries created during the session as well as a WORK (temporary) library. Select the library and designate a file name (example: test) for the output file. Click on Finish.
Analyzing the data.
Refer to the datafile by the output filename.
Example: proc means data=test ;Note: A two-level name, with library reference and filename, is required if the datafile is NOT in the WORK library.
Example:- designate a library with the libname command
earlier in the SAS session (from the Program Editor window):
libname mylib 'c:\temp' ; - select mylib for the library and test for the filename when designating the output file for the spreadsheet data
- refer to the output datafile with the two-level name when running procedures:
- proc means data=mylib.test ;
