We’re smarter together. Learn from this collection of community knowledge and add your expertise.

How do I do queries in SAS University Edition?

by Community Manager ‎04-30-2015 03:12 PM - edited ‎10-05-2015 03:07 PM (592 Views)

You’ve got data. Maybe you created or collected it yourself or got it from a third party. You want to know what’s interesting in it. Just as journalists question people, you must question your data. Think of a query as “interviewing” the data – seeing what information it holds, what’s missing and how it’s categorized, formatted and organized. You can do these things and more with SAS University Edition's Query Builder.

 

You can create a query based on one table or many tables if you join them together. When you create a query, SAS Studio 3.3 (University Edition’s interface) generates Structured Query Language (SQL) code to retrieve the information you want.

 

Here’s what SAS Studio’s Query Builder workspace looks like:

Query_Builder.png

 

To create a query:

  •   Click QueryBuilderbutton.png from the main SAS Studio toolbar. A query window opens on a new tab in the work area.
  • Add a table where indicated.

 

  To add additional tables:

  •   Click add.png and select Table. From the Choose a Table window, expand the appropriate library and select the table that you want to use. The table is added to the query.
  • Or use the Libraries section of the navigation pane. Click Libraries and expand the appropriate library. Drag the table that you want to use to the Tables tab of the query window.

 

After you specify all the criteria for your query, you can generate results by clicking Run.png on the query window toolbar. The output data opens in the workspace on a separate tab.

 

Copyright © SAS Institute Inc.
All rights reserved.
For more information

There’s much more to know about working with queries. Visit the SAS Studio 3.3 User’s Guide to better understand joins, learn how to select and filter data and manage output.

Contributors
Your turn
Sign In!

Want to write an article? Sign in with your profile.


Looking for the Ask the Expert series? Find it in its new home: communities.sas.com/askexpert.