SAS Enterprise Guide is a powerful, comprehensive
tool that enables you to perform most common
tasks with your data.
Let's check out some of its capabilities!
But first, what is SAS Enterprise Guide?
Enterprise Guide is an easy-to-use Microsoft
Windows client application that provides a
visual interface to SAS.
Whether or not you're a programmer, Enterprise
Guide has many features to meet your needs.
Let's start by taking a quick look at the
interface.
I've started Enterprise Guide, and by default,
the navigation area is to the left.
This area consists of several panes that provide
quick access to Enterprise Guide functionalities.
On the right, we see the work area, and the
Start page is open.
Enterprise Guide uses projects to manage collections
of related data, tasks, code, and results.
On the Start page, I'll click Create a new
project.
One of the major strengths of Enterprise Guide
is that it provides access to the power of
SAS through a point-and-click interface.
Let's look at an example of a task to describe
the main characteristics of the CARS table.
I'll click the Tasks pane in the navigation
area to view a list of available tasks.
I'll expand the Describe category and double-click
Characterize Data.
This task is in a wizard format that guides
you through the task in three simple steps.
In Step 1, I'll specify the data that I'd
like to report on.
I'll click Add, and from the Sashelp library,
I'll double-click the CARS table and then
click Next.
In Step 2, I'll select the report options.
I want all the output, so I'll leave all check
boxes selected and click Next.
Finally, in Step 3, I'll limit the maximum
number of unique categorical values to be
reported per variable to 15.
I'll click Finish to run the task.
The Characterize Data tab appears in the work
area with the Results tab displayed.
These reports and graphs can help me learn
more about my data.
I'll click the Last submitted Code tab to
view the SAS program that Enterprise Guide
generated.
Instead of typing this program myself, I was
able to point and click through a task to
quickly generate the code and the results!
If you're a SAS programmer and would like
to work with SAS programs instead, Enterprise
Guide has a modern editor that makes programming
a little easier.
Let's write some code to create a listing
report of the CARS table.
On the main toolbar, I'll go to File > New
> Program to open a new program in the work
area.
On the Code tab on the left, when I type pr,
a context-sensitive autocomplete appears with
PROC highlighted.
I'll press the spacebar to add the keyword
PROC and a space to my program.
I'll continue using autocomplete to complete
the statement: print data=sashelp.cars;
Now I'll use a VAR statement to select the
variables that'll appear in the report.
When I type var and press the spacebar, autocomplete
provides a list of columns in the CARS table.
I'll use this to enter Make Model Type Origin
MSRP;.
I'll finish the step with a RUN statement.
I was able to type this step very quickly
thanks to autocomplete!
I'll click Run to submit the program.
On the right side, the Results tab displays
a listing report of the table and the Log
tab includes messages from SAS.
I'll click the Process Flow tab to view the
contents of my project.
Here, I can also see the relationship between
the objects through the automatic links.
That was a quick look at both the point-and-click
and programming capabilities of SAS Enterprise
Guide.
Let's talk about how to navigate through the
SAS Enterprise Guide Environment!
When you open SAS Enterprise Guide, by default,
you see the work area on the right and the
navigation area to the left.
The work area currently displays the Start
page.
Under Get Started, I can create a new program
or project, or I can open an existing file.
So, what's a project?
A project is a single file that's a collection
of tasks and queries, SAS programs and logs,
notes, results, and shortcuts to data organized
into process flows.
Although you need a project to run a task,
if you're only writing code, you could do
that without creating a project.
To open an existing project, on the Start
page, I'll click Open an existing file.
My project is stored locally, so I'll click
My Computer > Browse and navigate to the Profit&ShippingAnalysis.egp
project file.
When I select it and click Open, the Profit
Analysis tab opens to display the process
flow.
This is a great way to view the items in the
process flow and to see the relationships
between them.
For example, I see that the customers, country_lookup,
orders, and products SAS tables are inputs
to the Order Detail query, and ORDERDETAIL
is the resulting table.
I'll click the down arrow next to Run.
Depending on what's selected in the process
flow, different run options are available.
I'll click Run process flow to run the entire
Profit Analysis process flow.
I'll click Submission Status in the bottom
right corner to view the status of the tasks.
The Status Information indicates that everything
ran successfully, so I'll click Close to hide
the Submission Status.
To view specific results, double-click the
corresponding icon in the process flow.
I'll double-click the bar chart icon labeled
Profit by Age Group.
The report looks great!
Now let's explore the navigation area.
It consists of several panes that provide
quick access to Enterprise Guide functionalities.
First, the Project pane displays the contents
of the active Profit&ShippingAnalysis project.
Notice that there are two process flows, Profit
Analysis and Delivery Analysis, that organize
the contents of the project.
The Open Items pane provides quick access
to items open in the current Enterprise Guide
session.
The items here correspond to the open tabs
in the work area.
The Servers pane shows a list of servers that
are known to Enterprise Guide, and the SAS
Folders pane displays the SAS folders that
I can access.
I can use both panes to open and add files
to my active project.
Next, the Tasks pane shows a list of point-and-click
tasks that I can use, and finally, the Prompt
Manager pane can be used to create, edit,
and delete prompts that allow for user input
in tasks and SAS programs.
Although these panes are initially docked
to the left, I can move them around.
I'll click Pane options on the Prompt Manager
pane and click Float.
Now I can click and hold the top of the pane
to freely position it within the application
or outside of it.
I can also drag a pane until a highlighted
region appears to dock the pane in various
predefined areas.
To remove the pane, I'll click Pane options
again and select Hide.
And to restore it, on the main toolbar, I'll
click View > Prompt Manager.
I can also float the tabs in the work area.
I'll drag the Profit by Age Group tab to float
it in my Enterprise Guide environment.
To restore the tab, I'll click Window options
and then select Dock as a tabbed document.
To quickly revert to the original layout,
on the main toolbar, click View > Reset to
default layout > Restore.
There are other settings and tools available
on the main toolbar.
For example, under Tools, you can use Options
to control many Enterprise Guide settings.
Under Help, you can quickly access both Enterprise
Guide and SAS programming resources.
I encourage you to explore these menus to
fully take advantage of all that Enterprise
Guide has to offer.
You have seen how to navigate through the
SAS Enterprise Guide environment.
You can use SAS Enterprise Guide to access
and use data from different file formats and
a variety of locations, so let's see how to
do this!
In my Enterprise Guide session, I've started
a new project.
I'll show you two ways to add SAS tables and
I'll also add a Microsoft Excel file.
To add both local and remote data to my project,
on the main toolbar, I'll click File > Open.
Here, My Computer provides access to data
in my local directory structure, including
network drives.
Servers provides access to locations where
SAS is installed and configured to work with
Enterprise Guide.
If you or your SAS administrator has defined
libraries to connect to your data sources,
you'll find them here in Servers.
If it is available, you'll also see SAS Folders
as an option to access data defined on the
SAS Metadata Server.
The SAS table I'd like to add to my project
is stored locally, so I'll select My Computer
> Browse and navigate to the orders table.
I'll select orders and click Open.
The table appears in the work area, and a
shortcut to the table is added to the Project
pane and to the active process flow.
You can follow these same steps to add files
from Servers or SAS Folders using the Open
window.
As an alternative to the Open window, in the
navigation area, you can use the Servers pane
and the SAS Folders pane
to quickly view and access your files and
data sources.
I want to add the local SAS table, customers,
so I'll use the Servers pane.
Under Servers, I'll expand Local > Files and
navigate to the customers table.
In the navigation area, I can add a file to
my project by dragging it to the Process Flow
tab or the Project pane , but I'll double-click
the file instead because this displays the
table in the work area.
What happens if I try to add a file that's
not a SAS table to my project?
I'll try to add an Excel workbook.
When I double-click the products.xls file
in the Servers pane, the workbook opens directly
in Excel, not in Enterprise Guide.
I see that this workbook is added to my project
but I can't use it in a task until I import
the data into one or more SAS tables.
This is easy with the Import Data Wizard.
I can launch the Import Data Wizard by selecting
File > Import data, but because the products
workbook is already added to my project, I
can use the Process Flow tab or the Project
pane instead.
I'll right-click products.xls in the Project
pane and select Import data.
In Step 1, I'll verify the file that I want
to import and provide some details for the
output SAS table.
I'll click Browse to change the table name
to ProductList and click Save, and then Next.
In Step 2, I'll select the worksheet or range
of cells to read in.
I want to read the ProductList worksheet,
and I know that the first row in the worksheet
contains the column names, so I'll leave those
selections as is.
I'll also select the Rename columns to comply
with SAS naming conventions check box, and
then click Next.
In Step 3, I can modify any of the field,
or column, attributes of the SAS table that
I'm creating.
I'll triple-click under Name for the first
column to change it to Product_ID and similarly,
change the label to Product ID.
I'll leave everything else at the default
values and click Next.
Finally, in Step 4, I can specify advanced
options.
I won't use these in this example, but you
can click the Help button to learn more about
each option.
I'll click Finish to import the data.
The resulting SAS table appears in the work
area, and it looks great!
Notice that the column names are displayed
by default.
To view the labels instead, click More options
and then select Show Labels.
When I go back to the Process Flow tab, I
see that the original Excel file, the Import
Data Wizard, and the resulting SAS table have
all been added to my project.
I can also use the Import Data Wizard to import
other file types such as Microsoft Access
and text files.
You've seen how easy it is to access data
from different locations and formats in SAS
Enterprise Guide.
Data on its own might not be very interesting
unless we can do something with it.
We can use a wide range of point-and-click
tasks in SAS Enterprise Guide to analyze,
report on, or manipulate our data, so let's
see how to do this!
In SAS Enterprise Guide, I've started a new
project and added the CARS table from the
Sashelp library.
I want to use a task to summarize the number
of cars in each car type.
To view a list of available tasks, click the
Tasks pane in the navigation area.
By default, the tasks are categorized, but
I'll click Sort and select Name to view an
alphabetical list of all tasks instead.
I could scroll through this list to find a
task, but I'll filter the task list to search
for Frequency to quickly locate the One-Way
Frequencies task.
When I position the cursor over a task, a
Help box appears, containing information such
as a description and the name of the SAS procedure
code that the task generates.
I use the One-Way Frequencies task often,
so I'll click the star to make it a favorite.
Another way to browse through tasks is to
click Open a task on the main toolbar.
This is a quick way to start favorite or recent
tasks.
Tasks are usually associated with a particular
table, so to make a table the active data
source, you can select the table either in
the Project pane or on the Process Flow tab,
then start a task through the Tasks pane or
the Open a task toolbar button.
But because our table is already open in the
work area, on the data grid toolbar, I'll
click Tasks to open a task using this data
set and select One-Way Frequencies under Favorite
Tasks.
The selection pane is on the left side of
the window.
You'll see different selections here depending
on the task, but most will have Data,
Titles, and Properties.
Let's explore each of these to create a report.
By default, the first category in the selection
pane, Data, is selected.
At the top, I'll verify the data source and
I can click Edit
to apply a basic filter, but I won't do that
for this example.
I'll assign variables from the input data
source to various task roles.
Some roles, such as the Analysis variables
role, require a variable,
and the icon next to the role shows that there
are variable type restrictions.
For example, I can assign only numeric variables
to the Frequency count role, but the Analysis
variables role accepts all variable types.
I want to know the number of cars in each
car type, so I'll drag Type to the Analysis
variables role.
You can also use the left and right arrows
to assign and remove variables from roles.
To learn more about each task role, you can
click the Help button.
In the Titles area, I'll clear the Use default
text check box and change the title to Number
of Cars per Type.
Next, in the Properties area, I'll click Edit
to modify some task properties.
To give the task a more descriptive name in
the project, in the default General area,
I'll change the label to Cars per Type and
click OK.
I'd like to modify a couple of options in
the other areas of the selection pane.
In Statistics, I'll change the frequency table
options to include Frequencies and percentages.
In Plots, I'll select the Vertical check box
to include a bar chart in the report.
Finally, in Results, I'll select the Create
data set with frequencies and percentages
check box, click Browse to change the table
name to typecount, and then click Save.
I'll click Preview code to see the code that
Enterprise Guide generates.
When I check Show custom code insertion points,
I can add my own SAS code into predefined
places.
I won't make any customizations to the code,
so I'll click Close . I'm finished making
selections, so I'll click Run to submit the
task.
The results are displayed on the Cars per
Type tab in the work area.
Here, the Results tab displays the one-way
frequency table and the bar chart.
The Last submitted code tab displays the task-generated
code.
The Log tab displays execution details, and
we can use the log summary at the top to quickly
check for any warnings, errors, or notes.
Finally, the Output Data tab displays the
resulting data set.
Looks great!
To re-run a task, simply click Run, or to
reopen the task to make any changes, click
Modify Task.
You can also right-click the task icon in
the Project pane or on the Process Flow tab
and click Run or Modify.
You've seen how to use a task, specifically
the One-Way Frequencies task, to create reports
and SAS tables in SAS Enterprise Guide.
We often need to manipulate our data in some
way before using it in a task.
The Query Builder in SAS Enterprise Guide
is a powerful tool that does that.
Let's use it to create the data that we need.
In SAS Enterprise Guide, I've started a project
and added the CARS table from the Sashelp
library.
I'll use this table to analyze the profit
of European cars.
Before I can do any sort of analysis, I want
to extract just the data that I'm interested
in.
There are several ways to start the Query
Builder, but because the table is already
open in the work area, I find it easiest to
select Query Builder on the data grid toolbar
to open the query builder using this data
set.
First, I'll change the Query name to Profit
of European Cars so that it's more descriptive.
Similarly, I'll click Change to change the
output table name to EuropeProfit, and then
click Save.
On the left side of the Query Builder is a
list of columns from the CARS table.
To include any of these in the output table,
I need to add them to the Select Data tab.
I can drag or double-click a column, but to
add several columns at once, I'll click Make,
hold down the Ctrl key, click Model, Type,
MSRP, and Invoice, and drag them over.
If I wanted to add all columns from cars,
I could've dragged the table name cars from
the list instead.
I want to analyze the profit of these cars,
but a Profit column doesn't exist in the input
table.
To create this, I'll click Computed Columns
and select New to start the New Computed Column
Wizard.
In Step 1, I'll select Advanced expression
as the type and click Next.
In Step 2, I'll enter the expression for the
new column.
Profit is calculated as the difference between
the MSRP and Invoice columns, so under Tables,
I'll expand CARS, double-click MSRP, type
a minus sign, and then double-click Invoice.
You could also enter the column names manually.
I'll click Next to move to Step 3 to modify
some of the column properties.
I'll change Column Name to Profit, and I'll
apply a format because it's a currency value.
I'll click Change to open the Formats window,
and in the Currency category, I'll select
the DOLLARw.d format.
I'll expand the Overall width to 7, click
OK, and then click Next.
Finally, in Step 4, I'll verify the details
of the new column.
Everything looks good, so I'll click Finish
to create Profit and Close out of the Computed
Columns window.
Notice that Profit has been added to the Select
Data tab
and is available in the list of columns under
Computed Columns.
Next, I'll filter the data so that the output
contains only European cars.
On the Filter Data tab, I'll click New Filter
to start the New Filter Wizard.
In Step 1, I'll leave the type as Basic Filter
and click Next.
I only want cars originating from Europe,
so in Step 2, I'll select the Origin column,
and click Next.
In Step 3, I'll build the basic filter.
I'll leave the Operator as Equal to, and for
Value, instead of typing it, I'll retrieve
a list of values from the CARS table.
I'll click the drop-down arrow , and on the
Values tab, I'll click Get Values and then
select Europe.
I'll click Next to verify the filter summary
in Step 4.
Everything looks good, so I'll click Finish
to create the filter.
I could create additional filters and customize
the grouping, but this is the only filter
I need for this example.
Finally, I'll sort the data by Profit.
On the Sort Data tab, I'll drag over the Profit
column.
I'll use the drop-down arrow to change the
sort direction to Descending to make it easier
to identify cars with the highest profits.
There's a lot more we can do in the Query
Builder, like change the output format, join
tables, summarize data, use prompts, and more!
To learn more, I encourage you to click the
Help button.
I'm done making my selections, so I'll click
Run to generate the results.
A new tab appears in the work area, and the
output table is displayed.
Now I can take this new table and feed it
into different tasks to further analyze profits
on European cars.
You've seen how to use the Query Builder in
SAS Enterprise Guide to subset data and create
new columns.
SAS Enterprise Guide has a full programming
interface with many great features that make
programming a little easier, so let's take
a look!
I have an existing SAS program, CarsOrigin.sas,
that I'd like to modify to generate summary
statistics.
There are several ways to do this.
When you open SAS Enterprise Guide, on the
Start page, you can choose to create a new
project and then add the program to the project,
or you can open the program without using
a project.
I'll do the latter, so I'll click Open an
existing file.
The SAS program is stored locally, so I'll
click My Computer > Browse, navigate to the
program, and double-click CarsOrigin.sas to
open it in a new tab.
This program reads in the cars table from
the Sashelp library and creates three tables,
asia, usa, and europe, that are based on the
origin of the car.
It also creates a listing report of the asia
table.
By default, the Code tab is on the left and
the Log tab is on the right.
I can drag the tab names to float the individual
tabs or rearrange this layout,
but I'll stay with the default layout.
The Code tab is where I'll write and submit
my code.
When I place the cursor on a keyword in the
editor, like var, a syntax help box appears.
It includes a description of the keyword,
as well as links to Product Documentation,
Samples & SAS Notes, and Papers.
Color coding is enabled in the editor to distinguish
keywords, quoted strings, formats, and more.
Before making any modifications to the program,
I'd like to run it.
There are many predefined keyboard shortcuts
in Enterprise Guide that I can use.
To view a list of these, on the main toolbar,
select Program > Enhanced editor keys.
One of my favorite shortcuts is the F3 key
as an alternative to Run.
You can even use this window to create your
own custom keyboard shortcuts!
I'll click Close to return to my program,
and press F3 to run the entire program.
The Results tab appears on the right with
a listing report of the asia table.
I'll click the Output Data tab to view the
resulting tables.
If there's more than one table, I can double-click
on each table name to view it.
Finally, I'll click the Log tab to view messages
from SAS.
By default, the log summary appears at the
top of the log.
This is a quick way to view any errors, warnings,
or notes that have been returned.
When I click a note in the log summary, the
corresponding note is highlighted in the log.
When I right-click the note and select Go
to program source, the portion of code that
produced the note is highlighted on the Code
tab.
Next, I'd like to add a report that calculates
summary statistics for the asia table, analyzing
MSRP.
To do that, I'll add a PROC MEANS step at
the end of my program.
When I type pr, autocomplete provides a list
of valid keywords.
PROC is highlighted, so I'll press the spacebar
to add the keyword PROC and a space to my
program.
Next, autocomplete provides a list of procedures,
so I'll type me and use the spacebar again
to add MEANS.
Now autocomplete gives me a list of valid
options for a PROC MEANS statement.
If you're unsure of what an option does, you
can place the cursor on the option name in
the autocomplete window to see a quick description.
I need to use the DATA= option, so I'll double-click
DATA= from autocomplete to add it.
A list of assigned SAS libraries appears.
I'll type w to highlight WORK, and when I
press the period key, work is added along
with a period.
Finally, I see a list of tables in the Work
library, so I'll type a and then a semicolon
to add asia and a semicolon to end the statement.
Next, I'll add a VAR statement to request
summary statistics for the MSRP column.
I'll type var and then press the spacebar,
and a list of columns in the asia table appears.
I'll type MS and then a semicolon to include
MSRP and end the VAR statement.
I'll close the step with a RUN statement.
To change these editor settings, on the main
toolbar, select Program > Editor options.
On the Appearance tab, you can control the
color coding and font.
On the Autocomplete tab, you can change or
disable autocomplete and the integrated syntax
help.
I'll click Cancel to continue editing my program.
To quickly improve the readability of the
program, click Format code.
Looks great!
I need to run only the PROC MEANS step, so
I'll highlight just that step and click Run.
An alternative is to use the F3 key.
The Results, Output Data, and Log tabs are
replaced to reflect only the PROC MEANS step.
I'll click Save "CarsOrigin.sas"on the main
toolbar to save the program.
You've seen some of the programming features
available in SAS Enterprise Guide, but there
are many more!
Some of these, such as snippets and editor
macros, can be found on the main toolbar under
Program.
I encourage you to explore these different
features to customize your SAS Enterprise
Guide experience.
