Getting Started with SAS Studio

Getting Started with SAS Studio


In this video, you get started with programming
in SAS Studio. You view a data table, write and submit SAS
code, view the log and results, and use tasks to quickly generate graphs and
statistical analyses. SAS Studio is a browser-based programming
interface that connects to a local or hosted SAS
server. The server processes the code and then returns
the results to your SAS Studio session. When you first open SAS Studio, you see a
navigation pane on the left and a work area on
the right. The navigation pane provides access to search
functionality, folders, and the libraries that
contain your files and tables. The Folders section is displayed by default. The work area displays a program window with
tabs for your code, log, and results. When you open data and run tasks, other
windows appear in the work area. Let’s start by viewing a SAS table. I’m going to select Libraries, and then expand
the SASHELP library. I’ll double-click the cars table to open it in the
table viewer on the right. The cars table contains 15 columns and 428
rows of data. The table viewer displays one page of data at a
time, each page containing 100 rows. You can use the arrows to navigate between
pages. In the Columns area of the table viewer, all of the
columns are selected by default. You can clear the check box for a column to
remove that column from the viewer. Notice that column names are used in the
preview, not column labels. If you’d like to customize the view, you can hide
the Columns area, maximize the table viewer,
and resize columns as needed. You can right-click a column heading to filter
and sort the data by that column. At the top of the table, you can see the number
of filtered rows. As you select options and customize the table
to look the way you want it to, SAS Studio is
generating SAS code that you can use. To view the query code, click the Display Query
button on the toolbar. A new program window appears with the code
that was used to create the view of the table in
the table viewer. You can then save that code for use later. Now I’ll write a SAS program that will enable you
to see the cars data in the form of a report. As I begin to type, you’ll notice the context-
sensitive Help. I’m going to turn this off for now, but we’ll come
back to this feature later, and I’ll show you how
very useful it can be. I’ll start by typing a PROC PRINT statement,
beginning with the keywords PROC PRINT. Then I specify the table name, sashelp.cars. I end the statement with a semicolon and then
complete the program with a RUN statement
that also ends with a semicolon. Now I’ll submit the program by clicking Run. Notice that results from the program are
displayed after the code has run. I’m going to check the log to make sure that the
program ran without errors. The log shows that SAS read 428 observations,
or rows, from sashelp.cars. There are no errors
or warnings. When I look at the results, I see a report that
displays all of the data from sashelp.cars. I can scroll to the bottom to see all of the data. The default results format is HTML, but I can
use buttons on the toolbar to download results
in RTF or PDF format. By the way, I can change the style for each
format by using the Results page on the
Preferences menu. I’d like to modify this report, in order to view only
a subset of these results. Before I write my program, though, I want to turn
the autocomplete feature of SAS Studio back
on. I’ll begin again by typing PROC PRINT. Notice that the Help for the PRINT procedure
includes syntax for some of the options used
with this procedure, as well as some basic information. There are also direct links to related SAS
documentation. I’m going to complete the PROC PRINT
statement by specifying the table name. Then I’ll use two of the options suggested by the
PROC PRINT syntax. I’ll include a BY statement and specify that I’d
like the cars table grouped by Make. Secondly, I’ll use a VAR statement to specify
the columns that I’d like included in the report. I’ll submit the program again, and the results
display the data grouped by Make. Now that I look at these results, I’d really like to
include the columns that provide gas mileage
data. I’ll go back to the VAR statement to add those
columns. Unfortunately, I don’t remember the
exact names of those columns. SAS Studio has a great shortcut for just this
type of situation. I’ll drill back down through the libraries to the
SASHELP library and expand the cars table. I can select the columns I want to include and
drag them directly into the VAR statement. I’ll submit the program again, and the results
now include the additional columns. In addition to features that make writing SAS
code faster and easier, SAS Studio also
includes powerful point-and-click tasks that quickly generate reports and graphs. Let’s
take a quick look at two of these. I’ll access the Tasks section of the navigation
pane. In the Statistics area, I’ll double-click
Summary Statistics to open the task. I’ll click the Select a Table button and select the
table that I want to use, sashelp.cars. Now I’ll click the plus and select Weight as the
analysis variable. Notice that SAS Studio automatically generates
the code for the MEANS procedure. On the Options tab, I can specify which options
I’d like to use. I’ll accept the default selections
this time and just run the program. The results of the analysis are shown in a
summary table. I can save this analysis if I want so that I can
reuse it later. Now let’s look at a Graph task. In the Tasks section, I’ll expand the Graph area
and double-click Bar Chart to open the task. Then I’ll select bodyfat3 in the libsas library for
the data table. I’ll select agegroup for the category variable and
pctbodyfat1 for the response variable. On the Options tab, I can also control the
details of what the bar chart will look like. I’ll add a title… modify the bar details… and then run the program. I’ve very quickly created the chart that I need. Remember that I can save the results in HTML,
PDF, or RTF format, making this chart very easy
to reuse and share. You’ve seen the power of SAS Studio to run
analyses and quickly create graphs and charts. You can view the additional videos in this library
to learn more.

18 thoughts to “Getting Started with SAS Studio”

  1. The only libraries I see are SASHELP, SASUSER, WEBWORK, and WORK. How do I get the remaining libraries, such as LIBSAS, for this tutorial?
    Thank you.

  2. I can’t seem to be able to select and add variables to the analysis variables. When I click the + button and select a column it only highlights the border of the column name rather than the entire box the name is contained in.

  3. Please kindly advise how to connect ORACLE TSN from SAS studio.  A simple connection to Oracle TSN Database please?  cannot find any details on the web.

  4. Amazing! I was reluctant to begin learning SAS (for my biostats class), but it's actually simple and maybe easier than R just from watching and going along with this Getting Started video. Now I can't wait to learn SAS and use it before my class starts! Thanks! Subscribing!

Leave a Reply

Your email address will not be published. Required fields are marked *