Run a SAS Program

Introduction

Run a SAS Program Icon in the SAS Data Loader Window
The directive Run a SAS Program provides the primary means of submitting user-written SAS code in SAS Data Loader for Hadoop. The code runs as you submit it, without the code generation step that is used in other directives. The code that you submit generates the same log and error information as in other directives. Also, the running code is tracked in the Run Status directive, and you can save and reuse jobs in Saved Directives.
The code execution process begins and ends in the vApp. The Workspace Server inside the vApp runs the code and executes all Base SAS language elements. If your code contains procedures that are enabled for DS2, or if your code contains native DS2 methods, then that code might be passed into the Hadoop cluster for execution. In your Hadoop cluster, DS2 code is executed by the SAS In-Database Code Accelerator for Hadoop.
Upon completion of DS2 execution on the cluster, the vApp receives notification and continues or concludes execution in the local Workspace Server.
For examples of DS2–enabled SAS code, refer to the code that is generated by directives such as Transform Data.
CAUTION:
Data sets in Hadoop are of indeterminate size. Any data that is indiscriminately returned from Hadoop to the vApp can overload the client.
To avoid overloading the vApp, your SAS programs need to minimize or eliminate the transfer of data from Hadoop to the vApp. It is generally preferable to define a result set or target table that remains in Hadoop. You can then analyze the data in Hadoop, or load data for further analysis onto a grid of SAS LASR Analytic Servers.
Note that you can generate code in any of the following software, and copy and paste that code into the Code task of the directive Run a SAS Program:
  • SAS Data Management Studio
  • SAS Enterprise Guide
  • SAS Data Integration Studio
Conversely, you can copy the code that is generated in any SAS Data Loader directive and paste into any SAS text editor. One suggested location for pasting SAS Data Loader code is the SAS Code Node in DataFlux Data Management Studio.
To include DS2 syntax in your SAS programs, you can use a number of SAS procedures that support DS2 language elements, as described in the SAS In-Database Products: User’s Guide. For DS2 syntax information, see the SAS DS2 Language Reference.
To run DS2 code directly in Hadoop using the SAS In-Database Code Accelerator, see the “SAS In-Database Code Accelerator for Hadoop” section of the SAS In-Database Products: User’s Guide.
User-written SAS DS2 code can be submitted in an expression builder in the following directives:
  • Delete Rows
  • Cleanse Data (Filter Transformation)
  • Transform Data (Filter Data task)

Example

Follow these steps to use the directive Run a SAS Program:
  1. In the SAS Data Loader directives page, click Run a SAS Program.
  2. In the Code task, type SAS code, or right-click to cut-and-paste existing SAS code.
    Tip
    The pop-up menu enables you to display line numbers and to navigate to the beginning or the end of the program.
  3. When your program is ready to run, click Next.
  4. In the Result task, click Start SAS program. As your program runs, you receive start and end date/time information, along with Log, Code, and possibly Error Details icons. Click the icons as needed to resolve errors.
    The final status of the job is displayed in the Result taskbar.
  5. Click Save to save your program for reuse. To edit or run your job in the future, go to the SAS Data Loader directives page and click Saved Directives.