Submitting SAS Code

Introduction to Submitting SAS Code

SAS under Windows provides several methods for you to submit your SAS programs for processing. SAS supports a variety of work strategies, whether you run SAS interactively or in batch, and in conjunction with other Windows programs or as a stand-alone application.

Submitting Code from the Enhanced Editor or Program Editor

To submit SAS code that you have entered into the Enhanced Editor or Program Editor window, you issue the SUBMIT command. SAS provides several ways to do this:
  • Press F3 or F8 when the editor window is active.
  • Click the Submit toolbar button.
  • Enter submit in the command bar.
  • Select Runthen selectSubmit.
You can use the SUBTOP command from either the command line or the Run menu to submit one or more lines of your SAS code. For more information, see SUBTOP Command: Windows .
Note: If you insert tabs while entering data in the DATALINES statement, you might get unexpected results when using columnar input. This issue exists when you use the SAS Enhanced Editor or SAS Program Editor. To avoid the issue, do one of the following:
  • Replace all tabs in the data with single spaces.
  • Use the %INCLUDE statement from the SAS editor to submit your code.
  • If you are using the SAS Enhanced Editor, select Toolsthen selectOptionsthen selectEnhanced Editor to change the tab size from 4 to 1.

Submitting Code from the SAS NOTEPAD Text Editor

SAS enables you to submit SAS code that you have entered into the SAS NOTEPAD text editor. NOTEPAD can be invoked by selecting Toolsthen selectText Editor when the Enhanced Editor is disabled. SAS provides several ways to submit the code in NOTEPAD:
  • Click the Submit toolbar button.
  • Enter submit in the command bar.
  • From the menu, select Runthen selectSubmit.

Submitting Code from the Clipboard

Using the Enhanced Editor or the Program Editor, you can submit SAS code that you copied from another Windows application (such as an editor or word processor) or from SAS Help and Documentation. When you copy text from another Windows application, that text is stored in the Windows clipboard.
From the Run menu in the Enhanced Editor or from the Program Editor window, select Submit clipboard. The code is submitted from the clipboard directly to SAS (without appearing in the Enhanced Editor or in the Program Editor window).Notes and results are sent to the SAS Log and to the Output window, respectively. The notes and results are displayed in the Results Viewer if it is active. You can still issue the RECALL command (or press F4) to recall the submitted program into the Enhanced Editor or into the Program Editor window.
You can also use the GSUBMIT command to submit SAS code that is stored in the clipboard. For more information, see GSUBMIT Command: Windows .

Submitting Code By Dragging and Dropping

Introduction to Submitting Code By Dragging and Dropping

You can drag SAS programs from other Windows applications onto an open SAS session and submit them. You can also drag files that contain SAS code and drop them onto an open SAS session to submit them.

Dragging Text from Other Windows

If you drag text from another Windows application or SAS window to the Enhanced Editor or the Program Editor window, that text is moved to the window by default. It is not submitted until you use one of the submit processes. See Submitting Code from the Clipboard.
If the application supports nondefault dragging of text, you can right-click the text to select it and then drop the text in the editor. When you drop the selection onto the Enhanced Editor or the Program Editor window, a menu appears and you can choose between moving the code or copying the code. The menu for the Program Editor also enables you to submit the code.

Dragging Files in an Interactive Session

By using the My Favorite Folders window, you can access files that exist outside the SAS environment. Files that contain SAS code can be dragged into your interactive SAS session for execution. Access the My Favorite Folders window by using the View menu.
If you drop a file that contains SAS code onto the Enhanced Editor window or on the Program Editor window, that code is included in the window (but not submitted). If you drop the file onto the Log or Output window or on a minimized SAS session, the code is automatically submitted.
When you minimize a SAS session, its icon appears on the Windows taskbar. You cannot drop a file onto the taskbar. Instead, you can drag the file to the SAS icon on the taskbar and hold it there, without releasing the mouse button. After about one second, the SAS window resumes its normal size. Then you can drop the file onto the open SAS session.
Dropping the file C:\MYPROG.SAS onto a window (other than the Enhanced Editor or Program Editor windows) of an open SAS session is the same as issuing this command:
gsubmit "%include 'c:\myprog.sas'";
You can submit more than one file at a time by selecting a group of files that contain SAS programs and then dropping them onto the open SAS session. The order in which the programs are run when they are submitted as a group is determined by Windows. Therefore, if order is important, you should drop each program file separately.
If SAS is busy when you drop a SAS program icon, the dropped file is ignored. The only indication that the dropped file was ignored is a warning beep.

Submitting Code Stored in Registered SAS File Types

During installation, the SAS Setup procedure registers certain file types with Windows to invoke specified actions when you double-click those types of objects. For example, files that have a file extension of .SAS are registered as SAS programs. These registered file types are displayed in Windows with a special icon, as shown here: Icon for SAS registered files
When you double-click a file that has this extension (or that has this icon), SAS is invoked and the contents of the file are included in the Enhanced Editor or Program Editor window. The SAS code that is contained in the file is not processed until you submit it (for example, by pressing F8 or by clicking the Submit tool). If you already have a SAS session running, double-clicking a file begins a second SAS session; it does not use the already-existing session.
SAS uses the default configuration file if you start SAS by double-clicking a registered SAS file type, such as .sas or .sas7bpgm.