Using SAS Enterprise Guide

This document details the common use cases for running SAS Enterprise Guide and how to bring data into the SAS engine.

Querying Databases

  1. If you have not already, configure and run your connections; see Configuring Connections in SAS Enterprise Guide.

  2. In the process flow work area, click Tasks > Browse.

    sas-usage-1
  3. Navigate to Data > Query Builder. You can also search for Query Builder in the search box. To favorite the task, click the star icon. Click Query Builder and click Open.

    sas-usage-2
  4. Click Servers in the left pane and navigate to Local > Libraries. You should see the various databases specified in your connections file.

    sas-usage-3
  5. Navigate into the database you want to query and find the table you want. Click Open.

    sas-usage-4
  6. You can now put together the various parts of querying the database table. You can drag and drop column names into any of the tabs. To join tables, click Join Tables and navigate to the table you want to join. SAS will automatically download tables as needed for heterogeneous joins (see https://documentation.sas.com/?activeCdc=egdoccdc&cdcId=egcdc&cdcVersion=8.3&docsetId=egug&docsetTarget=n18a187foaek0qn1ntln5smn6d7m.htm&locale=en ).

    sas-usage-5

Importing Local Data

  1. In the process flow work area, click Tasks > Browse.

    sas-usage-1
  2. Navigate to Data > Import Data. You can also search for Import Data in the search box. To favorite the task, click the star icon. Click Import Data and click Open.

    sas-usage-6
  3. Follow the prompts to locate the file on your local computer.

  4. Step through the Import Data wizard and confirm / change details, as necessary.

    sas-usage-7

Exporting Data

  1. In the process flow work area, right click the table you want to export and click Share > Export.

    sas-usage-8
  2. Enter a file name and location and change file types as necessary.

    sas-usage-9

Alternatively, you can configure exporting data as part of the workflow by clicking Export as a step in project and following the wizard.

Viewing and Modifying the SQL Query

  1. Follow the steps lisetd above in Querying Databases.

  2. Once you have the query in the process flow work area, right-click the Query Builder object and click Extract Code.

    sas-usage-10
  3. A new tab will open with the query in a PROC SQL tag. You are now able to copy and modify the query as needed. Note that the query references to tables are relative to the SAS WORK schema and you will likely need to modify database names as needed.

    sas-usage-11

Modifications to the query will NOT change the Query Builder object and modifications to the Query Builder object will NOT change this copy of the code.

Running Native SQL Queries

Download and open NativeQuery.sas for an example of running a subquery on the database.




Keywords:sas enterprise guide usage run query cross database join   Doc ID:114987
Owner:Steven T.Group:Office of Data Management & Analytics Services KB
Created:2021-11-24 14:49 CSTUpdated:2021-11-24 15:23 CST
Sites:Office of Data Management & Analytics Services KB
Feedback:  0   0