Getting Started under Windows |
Use SAS Interactively or in Batch Mode |
When running SAS under Windows, you can start an interactive session to submit programs and view the resulting output, or you can execute batch SAS jobs, and view the output later.
By default, invoking SAS begins an interactive SAS session. If you have a SAS program that you want to submit as a batch job, specify the SYSIN system option with the name of the SAS program file when you invoke SAS.
When you start SAS in an interactive session for the first time, you are asked if you want to learn some basic tasks by taking the Getting Started Tutorial. To start the tutorial, click Start Tutorial. If you do not want to be prompted to take the tutorial, select Don't show this dialog box again. You can start the tutorial at any time by selecting Help Getting Started with SAS Software
Starting from the Start Menu |
To start SAS from the Windows Start Menu:
Starting from Custom Shortcuts or Program Items |
During installation, the Setup program automatically creates a program item in the Start menu that you can use to start SAS. However, you can create multiple SAS items within a folder to represent several differently configured SAS sessions. Also, if you want SAS to start every time you start Windows, you can place a program item or shortcut in the Startup folder. For information about creating shortcuts, see your Windows documentation.
After you have created a shortcut to SAS, you can append system options to the SAS command. To append system options:
In the Target field, append the system options to the SAS command. Remember that double quotation marks are required around pathnames. For example,
"c:\program files\SAS\SASFoundation\9.2\sas.exe" -config "c:\mydir\sasv9.cfg"
Starting from the Run Dialog Box or a Command Prompt |
If you start SAS by using a command line (either from the Run dialog box or the Command Prompt window), you might want to specify the SAS configuration file location through the CONFIG system option. Even if you use the default configuration file SASV9.CFG, specify the file to ensure that SAS uses the configuration file that you want. For more information about how SAS searches for the configuration file, see How SAS Finds and Processes Configuration Files.
When the WORK and SASUSER system options are set, the Work and Sasuser data libraries reside in the specified paths regardless of the path from which you invoke SAS. For more information about the Sasuser data library, see Profile Catalog. For more information about the Work data library, see Work Data Library.
To start an interactive session by using the Run dialog box
In the Open field, type the path and the exact name of the program file, including the extension and options.
For example, if SAS is installed in the default folder c:\Program Files\SAS\SASFoundation\9.2, you type c:\program files\SAS\SASFoundation\9.2\sas.exe , and the options that you want to specify.
You can start either an interactive SAS session or a batch SAS job by typing the SAS command at the command prompt. For example, the following command starts an interactive session, specifies the page size and line size, and indicates the location of the SAS configuration file:
c:\program files\SAS\SASFoundation\9.2\sas.exe -ls 80 -ps 60 -config c:\program files\SAS\SASFoundation\9.2\sasv9.cfg
This command starts a batch SAS job in a similar manner:
c:\program files\SAS\SASFoundation\9.2\sas.exe -sysin c:\mysas\programs\prog1.sas -config c:\program files\SAS\SASFoundation\9.2\sasv9.cfg
Note: These examples are displayed on multiple lines because of space limitations. When you enter a command from the command prompt, the command must be on one line.
Starting from a SAS File |
There are two ways to start SAS from a SAS program file in Windows Explorer.
Submitting a Batch SAS Job |
There are several ways to submit a batch SAS job:
Specify the SYSIN system option in the SAS command (issued from the command prompt or from the Run dialog box) to specify the SAS program to submit.
Right-click a file that has a .sas or .sasv7bpgm file extension. From the pop-up menu, select Batch Submit.
Use the Windows Explorer and drag your SAS program file icon (the file that contains the SAS code) to the SAS.EXE file icon or shortcut.
When you run SAS in batch mode, SAS displays a Status window for the SAS job that you submit. This window tells you the name of the SAS job that is running and where your log and procedure output files are written. This window remains open until the SAS job is complete.
If you do not want to see the status window while your batch SAS job is running, invoke SAS with the ICON system option so that the status window becomes an icon when your job is running. You can also minimize the status window by clicking the Icon button when the window appears. The icon shows the busy cursor (usually an hourglass) while the SAS job is running. The icon disappears when the job is complete.
You can cancel a batch job by using either the keyboard or the mouse:
You can run windowing procedures along with SAS/GRAPH, SAS/INSIGHT, and SAS/ACCESS software, in a batch SAS job. When SAS reaches a point in your program where interaction is required, it opens the main SAS window.
Starting the Program Editor When SAS Starts |
The Enhanced Editor is the default editor that starts when you start SAS. If you prefer to use the Program Editor, use one of the following methods to start the Program Editor when SAS starts:
Start SAS with the NOENHANCEDEDITOR system option:
sas.exe -noenhancededitor
Disable the Enhanced Editor in the Edit tab of the Preferences dialog box.
For additional information, see Switching from the Enhanced Editor to the Program Editor, Edit Preferences, and ENHANCEDEDITOR System Option: Windows.
Determining the Current Folder When SAS Starts |
By default, SAS determines the current folder. SAS uses the current folder as the location to read and write SAS files when you do not specify a different pathname.
SAS also searches the current folder, based on the following statements, for the AUTOEXEC.SAS file or INITSTMT files. In this case, the path that the SASINITIALFOLDER system option specifies is disregarded.
However, you can specify a pathname to use for the current folder by using the SASINITIALFOLDER system option when you start SAS. Alternatively, you can use the following rules to determine the current folder:
If you use a program item or shortcut to start SAS and if a path is specified in the Windows Properties Shortcut tab (Start in field), SAS uses that path as the current folder.
If you use a command to start SAS by using either the Run dialog box or a command line and if the command contains a path to the SAS.EXE file, the current folder is the path that you specify as part of the SAS command, regardless of where Windows actually finds the SAS.EXE file.
If you use a command to start SAS and if you do not specify a path as part of the SAS command, then the current folder is specified by the path from which you issued the command.
If Windows cannot find the SAS.EXE file in the specified folder, the folder that is specified in the SAS command still becomes the current folder and Windows searches for the SAS.EXE file by using the Windows PATH environment variable.
For example, if you specify the following command, C:\MYSAS is the current folder, regardless of whether the SAS.EXE file is actually in that folder:
c:\mysas\sas.exe -config c:\mysas\sasv9.cfg
For more information, see Changing the SAS Current Folder and SASINITIALFOLDER System Option: Windows.
Note: Do not confuse the current folder with the Work data library. For more information about the Work data library, see Work Data Library.
Sample SAS Session |
You can invoke SAS from the Start menu by, selecting Programs SAS 9.2.
The following display shows the Enhanced Editor and Log windows with a sample SAS program that is ready to be submitted. This program creates a SAS data set called Oranges, which contains the results of a taste test on four varieties of oranges. The program sorts the data set by the total test score and prints the data set.
Submitting the Sample SAS Program
The following SAS code appears in the Enhanced Editor window:
ods rtf file="c:\em\oranges.rtf"; data oranges; input variety $ flavor texture looks; total=flavor+texture+looks; cards; navel 9 8 6 temple 7 7 7 valencia 8 9 9 mandarin 5 7 8 ; proc sort data=oranges; by descending total; run; proc print data=oranges; title 'Taste Test Results for Oranges'; run; ods rtf close;
After you submit the program, the output appears in the Results Viewer window as follows:
The items in the SAS menu bar at the top of the main SAS window change, depending on which window is active within the SAS session. In addition, you can access window-specific pop-up menus, which offer the same menu choices. The pop-up menu in the following display was generated by right-clicking in an Enhanced Editor window.
Pop-up Menu in the Enhanced Editor Window
When you are ready to end your SAS session, double-click the SAS control menu (the small icon in the upper-left corner of the main SAS window) or click the X (in the upper-right corner) and click OK when the dialog box verifies your request.
Note: If you have disabled the Confirm Exit of SAS option in the Preferences dialog box, your SAS session ends without asking if you are sure you want to end the session. For more information about how to customize your SAS session, see Setting Session Preferences.
What If SAS Does Not Start? |
If SAS does not start, the SAS log can contain error messages that explain the error. Any error message that SAS issues before the SAS log is initialized is written to the MSG window, if it is available, or to the SAS console log, which is a Windows file. Under Windows Vista, the SAS console log is typically located in c:\Users\user-ID\AppData. In all other Windows operating environments, the SAS console log is typically located in c:\Documents and Settings\user-ID\Application Data. You can obtain the location and filename for the SAS console log from the application event log. To open the application event log, submit eventvwr from the Run dialog box and click Application.
If SAS does not start, if the screen appears and then disappears, or if SAS is very slow to open, you might have a problem with a missing printer, a damaged printer driver, or a failed network printer connection. Use the following steps to correct this problem:
Verify that the printers are linking to valid network servers. If the printers are linking to invalid servers, then delete the printers by accessing Start Settings Control Panel Printers.
Download a new printer driver from the printer's Web site and replace the current driver with the new driver.
Rename profile2.SAS7bcat to profile2.old and rename profile.SAS7bcat to profile.old at c:\Documents and Settings\user-ID\My Documents\My SAS Files\9.2\.
Start SAS.
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.