Chapter Contents

Previous

Next
SAS Companion for the Microsoft Windows Environment

Starting the SAS System

The following sections describe several ways in which you can invoke the SAS System from your Windows environment.


Starting from the Start Menu

To start SAS from the Windows Start Menu:

  1. Click on [Start] to open the Start menu.

  2. Point to Programs.

  3. Select The SAS System.

  4. Select The SAS System for Windows V8.


Starting from Custom Shortcuts or Program Items

During installation, the SAS System Setup program automatically creates a program item or shortcut that you can use to start the SAS System. 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 on creating shortcuts, see your Windows documentation. Starting the SAS System shows an example of a SAS item from the Start menu in Windows NT Workstation.


Starting from the Run Command or Command Prompt

When starting the SAS System using a command line (either from the Run dialog box or the Command prompt), you might want to specify the SAS configuration file location using the CONFIG system option, even if you use the default name of SASVx.CFG (x is the version of the SAS System), to ensure that the SAS System uses the configuration file you want. For more information about how the SAS System searches for the configuration file, see How the SAS System Finds and Processes Configuration Files.

When these 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 on the SASUSER data library, see Profile Catalog. For more information on the WORK data library, see WORK Data Library

Using the Run Command

To start an interactive session using the Run command, select Run from the Start menu. Type the path and the exact name of the program file, including the extension and options, in the Run dialog box. Click on [OK].

For example, if SAS is installed in C:\SAS, you would type c:\sas\sas, plus any 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:\SAS\SAS.EXE -LS 80 -PS 60 
               -CONFIG C:\SAS\SASV8.CFG

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

C:\SAS\SAS.EXE -SYSIN C:\SAS\PROGRAMS\PROG1.SAS 
               -CONFIG C:\SAS\SASV8.CFG


Invoking the SAS System in Interactive Mode versus Batch Mode

When running the SAS System under Windows, you can use an interactive session, which lets you interact with the SAS System interface to submit programs and view the resulting output, or you can execute batch SAS jobs, which run without any interaction with you, and whose output you can view later. You can use any of the previously discussed methods to start the SAS System in either mode. By default, invoking the SAS System 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 the SAS System.

Submitting a Batch SAS Job

When you run SAS in batch mode, SAS displays a Status window for the SAS job 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.

You can run windowing procedures, such as those associated with SAS/GRAPH, SAS/INSIGHT, and SAS/ACCESS software, in a batch SAS job. When the SAS System reaches a point in your program where interaction is required, it opens the main SAS window.

If you do not want to see the Status window while your batch SAS job is running, invoke the SAS System 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 on [Icon] when the window appears. The icon shows the busy cursor (usually an hourglass) while the SAS job is running and disappears when the job is complete. You can cancel a batch job by either pressing CTRL+BREAK or clicking on [Cancel] in the Status window.

There are several ways to submit a batch SAS job:


Setting the Current Folder

The SAS System uses a current folder as the default location to read and write SAS files when you do not explicitly specify a different path. (In Version 7 of the SAS System, the working folder also contained the system profile catalog. In Version 8, the system profiles are kept separated from the working files.)

Under Windows, the following rules are used for determining the current folder for the SAS System:

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

  2. If you don't use the program item or shortcut to start SAS (using the Run dialog box or DOS command line instead), and Windows successfully loads the SAS.EXE file from the path specified in the SAS command, that path is the working folder. In other words, the working folder is the path you specify as part of the SAS command, regardless of where Windows actually finds SAS.EXE. If you don't specify a path as part of the SAS command, then the working folder is the path from which you issued the command.

Note:   If Windows cannot find the SAS.EXE file in the specified folder, the folder specified in the SAS command still becomes the working folder and Windows searches for the SAS.EXE file using the Windows PATH environment variable.  [cautionend]

For example, if you specify the following command, C:\SAS is the working folder, regardless of whether the SAS.EXE file is actually in that folder:

C:\SAS\SAS.EXE -CONFIG C:\SAS\SASV8.CFG

You can change the SAS working folder from within your SAS session. For more information, see Changing the SAS Current Folder.

Note:   Do not confuse the SAS working folder with the SASWORK data library. For more information, see WORK Data Library.  [cautionend]


Sample SAS Session

This section illustrates invoking the SAS System from the Start menu, submitting a sample SAS program, examining the program output, and ending the SAS session. Starting the SAS System shows a possible configuration of the SAS program item in the Start menu. Select The SAS System for Windows V8 to start the SAS System.

Starting the SAS System

[IMAGE]

Submitting the Sample SAS Program shows the Enhanced Editor and Log windows with a sample SAS program 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. Then the program sorts the data set by the total test score and prints the data set.

Submitting the Sample SAS Program

[IMAGE]

The following is the SAS code that appears in the Enhanced Editor window:

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;

Once you submit the program, the output appears in the Results Viewer window, as shown in Looking at the Program Output.

Looking at the Program Output

[IMAGE]

The items in the main SAS System menu bar at the top of the 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. To access the pop-up menus, click the right mouse button with the cursor in the window for which you want to see menus. Pop-up Menus in the Program Editor Window shows a series of menus in the Program Editor window. This series was generated by first clicking the right mouse button with the cursor in the Program Editor window, then selecting File and New.

Pop-up Menus in the Program Editor Window

[IMAGE]

When you are ready to end your SAS session, double-click on the SAS System control menu (the small icon in the upper-left corner of the main SAS window) or click on the [X] (in the upper-right corner) and click on [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.  [cautionend]


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.