Starting SAS


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, whose output you can view 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 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:

  1. Click Start .

  2. Select Programs .

  3. Select SAS .

  4. Select SAS 9.1 .

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 do this,

  1. Open the SAS Properties window and click the Shortcut tab.

  2. In the Target field, append the system options to the SAS command. Remember that double quotation marks are required around path names . For example,

     "c:\program files\sas\sas 9.1\sas.exe" -config "c:\mydir\sasv9.cfg" 

Display 1.1 on page 10 shows an example of a SAS item from the Start menu under Windows 2000 Professional.

click to expand
Display 1.1: Starting SAS

Starting from the Run Dialog Box or a Command Prompt

Specifying the SAS Configuration File

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 on page 15.

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 on page 19. For more information about the Work data library, see Work Data Library on page 21

Using the Run Dialog Box

To start an interactive session by using the Run dialog box

  1. Select

    Start Run

  2. In the Open field, type the path and the exact name of the program file, including the extension and options.

  3. Click OK .

For example, if SAS is installed in the default folder c:\Program Files\SAS\SAS 9.1, you type c:\program files\sas\sas 9.1\sas.exe , and the options that you want to specify.

Using the SAS Command from the Command Prompt

You can start either an interactive SAS session or a batch SAS job by typing SAS 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\sas 9.1\sas.exe -ls 80 -ps 60     -config c:\program files\sas\sas 9.1\sasv9.cfg 

This command starts a batch SAS job in a similar manner:

 c:\program files\sas\sas 9.1\sas.exe     -sysin c:\mysas\programs\prog1.sas     -config c:\program files\sas\sas 9.1\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.

  • Double-click on a SAS program file

  • Right-click on a SAS program file and select the appropriate action.

Submitting a Batch SAS Job

Ways to Submit 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 (for the file that contains the SAS code) to the SAS.EXE file icon or shortcut.

The Status Window

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.

Cancelling a Batch Job

You can cancel a batch job by either

  • pressing CTRL+BREAK

  • clicking Cancel in the Status window.

Windowing Procedures in a Batch Job

You can run windowing procedures, such as those that are associated 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 on page 108, Edit Preferences on page 59, and ENHANCEDEDITOR System Option on page 501.

Determining the Current Folder When SAS Starts

SAS uses the current folder as the default location to read and write SAS files when you do not explicitly specify a different path.

You can specify a pathname to use for the current folder by using the SASINITIALFOLDER system option when you start SAS or use the following rules to determine the current folder:

  1. If you use a program item or shortcut to start SAS and a path is specified in the Windows Properties Shortcut tab ( Start in field), SAS uses that path as the current folder.

  2. If you use a command to start SAS by using either the Run dialog box or a command line and the command contains a path to SAS.EXE, 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.

  3. If you use a command to start SAS and you do not specify a path as part of the SAS command, then the current folder is 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 

Under Windows NT, when you start SAS from a file as explained in Starting from a SAS File on page 8, the default current folder is the path to the operating system with \system32 appended to it. An example of a default current folder under Windows NT is C:\winnt\system32 . Other operating systems default to the folder where the file is stored. You can specify the current folder when you start SAS.

For more information, see Changing the SAS Current Folder on page 37 and SASINITIALFOLDER System Option on page 546.

Note: Do not confuse the current folder with the Work data library. For more information about the Work data library, see Work Data Library on page 21.

Sample SAS Session

This section illustrates

  • invoking SAS from the Start menu

  • submitting a sample SAS program

  • examining the program output

  • ending the SAS session.

The following display shows a possible configuration of the SAS program item in the Start menu. Select SAS 9.1 to start SAS.

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.

click to expand
Display 1.2: 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 :

click to expand
Display 1.3: Looking at the Program Output

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 clicking the right mouse button with the cursor in an Enhanced Editor window.

click to expand
Display 1.4: 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 on page 57.

What If SAS Does Not Start?

If SAS does not start, the SAS log may 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. Under Windows NT, the SAS console log is located in the c:\winnt\Profiles\ username \Application Data folder. In all other Windows operating environments, the SAS console log is located in the c:\Document and Settings\ userid \Application Data folder. You can obtain the 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 on Application .




SAS 9.1 Companion for Windows
SAS 9.1 Companion for Windows (2 Volumes)
ISBN: 1590472004
EAN: 2147483647
Year: 2004
Pages: 187

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net