sas enterprise guide best of both worlds – is it right for you? sunil gupta...
TRANSCRIPT
SAS Enterprise Guide
Best of Both Worlds
– Is it Right for You?
Sunil [email protected]
www.SASSavvy.com
SAS Display Manager World
SAS Enterprise Guide World
SAS Display Manager World SAS Enterprise Guide World
Technical Non-Technical, Technical
Requires More Time for Programming Requires Less Time for Programming using up to 90 Tasks
One Dataset/Program/Output File per window
Cross Reference/Query Multiple Intermediate Datasets/Programs/
Output Files
Open Programmer’s working environment
(Interactive – DATA Step Debugger)
Controlled Analyst’s working environment
(Defaults, Batch Processing)
Non-Visual Programming Visual Process Flow 3
What’s in a Name?
SAS Same Power as base SAS
Enterprise Wide scope and integration
with data source and output
channels within ONE file
Guide Standardize and automate tasks
and queries, execute difficult or
infrequently used SAS Procedures 4
Free with PC SAS
What type of SAS User are you?
New/Experienced SAS Programmer – Create and run SAS programs
Statistician – Exploratory statistical analysis, graphic templates
Manager – As is or running stored procedures
5
What types of programming tasks are supported?
Data Access Import data or Data Step
to access excel , raw data
Data Management Query Builder and Edit
Checks with Proc SQL
Data Reporting Tasks Drag-n-Drop, Proc
Tabulate, Proc Transpose
Data Analysis ODS Statistical Graphics
6
7
Interface vs. Integrate SAS EG Camps
Run SAS Programs as separate files from one SAS EG project file.
Trouble-shoot data issues with query management. Do not depend on SAS EG for production runs.
Embed SAS Programs within SAS EG. Use SAS EG tasks to help
process data for analysis. Allow
managers access to data and reports.
What If SAS EG Could?
• Help with querying and validating? Query exploration and management
• Help with documentation? More portable package format (Notes, SAS Program, List, Log and Output file)
• Enforce standards and automation?
Fully compatible with SAS macros and menus• Help with prototyping table layouts and performing
complex statistical analysis? Yes with feature to create custom tasks
8
9
SAS Enterprise Guide: The Basics
Point-and-Click
Drag-and-Drop
SAS
Programming
Required!
All results are saved to one project file!
10
SAS Enterprise Guide: The Basics
Update SAS programs
from within Enterprise
Guide
Single Data set
Enterprise Guide Task
SAS Programs
Automatic access to
current data
Store all within one project file – program, log, & list.
Access results within one project file – RTF, PDF, & HTML.
11
SAS Enterprise Guide: The Basics
Follows a Typical Process Flow
Enterprise Guide tasks make programming easier!
Access Raw Data
Create Query, Merge
Data sets
Create Variables,
Formats
Analysis&
Reporting
Results as RTF, HTML, etc.
12
Process Flow Diagram
13
Enterprise Guide: The Interface
EG Windows - Project, Task, Workspace
14
Simulate SAS Display Manager
15
Enterprise Guide Task List
- Select by Category
- Select by Task Name*
- Select by Toolbar
- Create RTF, HTML, PDF, etc.
- Change the Output Style
16
Enterprise Guide Task List
Select by Task Name*
- MEANS - FREQ etc.
* Many SAS procedures
from SAS/BASE, SAS/GRAPH, SAS/STAT, SAS/ETS, SAS/QC
Ideal for programmers!
17
Enterprise Guide Task List
Select by Toolbar - Descriptive - List Data - Summary Statistics etc. - Table Analysis etc.
Alternative to directly using SAS Procedures
18
Behind the scenes
19
Behind the scenes
20
Enterprise Guide Task Rules
Over 90 tasks to choose from
Each task is associated with a SAS Procedure- Simple Listing only for PROC REPORT Task may not contain all SAS Procedure options- Can copy and customize SAS code
Once you learn one task, other tasks are similar- Organized as tabs to specify variables and options
First access data set or query before selecting tasks
- Task needs to know the variables to display
Assure all variables exist in single data set or query
21
Which are the most profitable products?
Point-and-click the Sales data set to become active Point-and-click the Summary Tables Task Make the following tab selections
COLUMNS Assign SALES and QUANTITY as Analysis variables Assign CATEGORY and PRODUCT as Classification variables
TABLE Assign the following column variables: QUANTITY and SALES Assign the following row variables: CATEGORY and PRODUCT
RESULTS No need to save results to a data set
TITLES Enter text ‘Table 1.1 Sales Statistics by Product’
TAB Description*
* Instructions Required
22
SAS Enterprise Guide: Tasks
I. Project Setup Tasks II. Data Management Tasks
III. Analysis and Reporting Tasks
Process Training Required.
Logical sequence of events.
Organized approach to non-programming.
23
I. Project Setup Tasks
Project Setup Tasks Description_________Create Code Assign Libname statement ex. libname dfile ‘c:\data’;
Create Code* Create data set
ex. data test; etc.; run;
Create Format Create & Assign formats
ex. proc format; etc.; run;
* Programmer’s task - ex. proc reportKey Point: Access data sets and assign formats
24
II. Data Management Tasks
Data Management Tasks Description_________Create Query Add variables and formats
ex. salegrp, salegrp.
Apply subset condition
ex. 2002 sales data
Create Parameter Query* Add filter
ex. Select a product
* Can easily create a basic user-friendly interface Key Point: Subset data set, create new variables,
useful for ad-hoc requests
Proc SQL
25
Create Query Task:Merge Data Sets
Points to data set (does not copy the data set) Be careful NOT to move the source data sets Can create new permanent data set Single data set or query is required for tasks
BA
C
26
II. Data Management Tasks: Parameter Query
Example of one user prompt to ‘Select a Product’.
Can add more variables to restrict query.
Returns data set with only products selected.
Can use data set as source for EG tasks.
27
III. Analysis and Reporting Tasks
Analysis & Reporting Tasks Description__________Summary Table Sales Statistics Table, ex. proc
tabulate
Listing Detail Sales Listing, ex. proc print
Statistical Analysis Differences in yearly sales?
ex. proc t-test
Graphs How much have sales risen this year?
ex. proc gchart
Key Points: Select the appropriate task,
Query explore any intermediate dataset, Save all queries in project file
28
SAS Programming Options
Four Points of Custom Program Entry ________1. Execute code when first opening project file such as
setup.sas.
2. Execute code before or after running a task.
3. Insert custom code at predetermined points within a task to run with task. Examples include before or after DATA step or SAS Procedures and SAS Procedure statements or options.
4. Execute copied and customized generated code from task from a new program window.
Query Exploration and Management
LAB1
• Query 301 and labtest = ‘CHEM_ALB’• Query 302 and labtest = ‘HEM_ANC’
LAB2
• Query 301 and labtest = ‘CHEM_ALB’ • Query 302 and labtest = ‘HEM_ANC’
LAB
• Characterize Data• Save as permanent dataset
Intermediate Datasets
[Select Variables, Subset Condition, and Sort Order]
Recreate QueriesHow do you think dates are selected?
(DATA step update to LAB2)
(DATA step update to LAB)
30
Graph Task: Chart Gallery
SAS Programming
31
Typical Business Model
Different Viewpoints of the Same Data
Viewpoint Example Question________________ Customer Which are the most profitable
customers?
Product What are the product sales acrossmarket segments –
Retail/Catalog?
Organization How successful are the marketingand sales campaign
promotions?
Once a table is created, it is easy to change the table to a different viewpoint!
32
Selecting Analysis and Reporting Tasks
How well do you know your business?
You’ve got questions, Enterprise Guide has answers!
PRODUCT? - ShoesCUSTOMER? - AcmeREGION? - NorthernMARKET SEGMENT? - Retail SalesTIME PERIOD? - 4th Quarter, 2001PRODUCT GROWTH? - Slippers
WHICH IS THE BEST ?
SAS Enterprise Guide Best Practices Tips:
1. Some level of training is required.
2. Write to SAS programs instead of embedding the SAS programs to keep as separate files.
3. Take advantage of Notes Task to document steps.
4. Apply ‘Save As’ instead of ‘Save’ to prevent accidental replacement of another project file.
5. Be careful when saving files when multiple projects opened.
33
continue …
SAS Enterprise Guide Best Practices Tips:
6. Take advantage of process flow diagram to visualize project code and tasks.
7. Take advantage of split panel to simultaneously view dataset and SAS program.
8. Take advantage of order list option to create batch jobs.
9. Take advantage of viewing each HTML/RTF/PDF file, for example, when creating multiple files.
10. For best debugging, keep all unique intermediate dataset names to view each data step sequence.
34
continue …
SAS Enterprise Guide Best Practices Tips:
11. Put on your data mining hat to query explore most any intermediate dataset created to confirm assumptions.
12. Plan to follow a migration plan with your most open SAS programmers before your closed SAS programmers.
35Build Your Own Best Practice Tips
36
SOP Compliance and Best Practices
Characterize Data Task – Categorical Data
37
Automatic for both character and numeric variables. Can specify number of unique values to display.
Characterize Data Task – Continuous Data
38
Automatic for each numeric variable.
Characterize Data Task – Continuous Data
39Option to display as graphs or save as dataset.
40
SAS Programmers Tool - Syntax
proc report data=mydatea.sales nowd split="*" headline; column product year,(quantity sales pct_prd) quantity=grd_tot sales=grd_pct; define product / group 'PRODUCT'; define year / across 'Sales by Year' center; define quantity / sum 'N' center format=comma6.; define sales / sum 'Total' format=dollar8.; define pct_prd / computed '% Total' width=5 format=pctf.; define grd_tot / sum 'QNTY Total' format=comma6.; define grd_pct / sum 'SALES Total' width=5 format=dollar8.; compute before; gt1=_c3_; gt2 = _c6_; gt3 = _c8_; endcomp; compute pct_prd; _c4_ = (_c3_/gt1)*100; _c7_ = (_c6_/gt2)*100; endcomp; rbreak after / summarize skip ol ul; compute after; product = 'Total'; endcomp;run;
Yes, you can write your own code.
41
Moving EG Code to Production All Enterprise Guide code can be exported
Enhance EG code with style options
Very useful to develop prototype without writing code
For any task, select Preview Task Code
Create Code Task (Programmer’s Task)
SAS EG 4.3 has fill-in editor and WHERE tab
SAS Enterprise Guide’s Top Three Unknown Benefits
Top Four Unknown Benefits Brief Description
Characterize Dataset Automatic PROC FREQ and PROC MEANS
Split screen to view multiple windows See both program and dataset or log files
Query Multiple Intermediate Datasets Save sort and filters for each data review
Production Runs Link and run programs in sequence
42
43
On-Demand SAS Demos
44
SASSavvy.com: Top SAS Enterprise Guide Papers
45
SAS Enterprise Guide
Best of Both Worlds
– Is it Right for You?
Sunil [email protected]
www.SASSavvy.com