SAS Enterprise Guide Best of Both Worlds Is
SAS Enterprise Guide Best of Both Worlds – Is it Right for You? Sunil Gupta Sunil@Gupta. Programming. com 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 Free with infrequently used SAS Procedures PC SAS 4
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
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. 7
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
SAS Enterprise Guide: The Basics Point-and. Click All results are saved to one project file! Drag-and. Drop SAS Programming Required! 9
SAS Enterprise Guide: The Basics Single Data set Automatic access to current data Enterprise Guide Task SAS Programs Update SAS programs from within Enterprise Guide Store all within one project file – program, log, & list. Access results within one project file – RTF, PDF, & HTML. 10
SAS Enterprise Guide: The Basics Follows a Typical Process Flow Access Raw Data Analysis & Reporting Create Query, Merge Data sets Create Variables, Formats Results as RTF, HTML, etc. Enterprise Guide tasks make programming easier! 11
Process Flow Diagram 12
Enterprise Guide: The Interface EG Windows - Project, Task, Workspace 13
Simulate SAS Display Manager 14
Enterprise Guide Task List - Select by Category - Select by Task Name* - Select by Toolbar - Create RTF, HTML, PDF, etc. - Change the Output Style 15
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! 16
Enterprise Guide Task List Select by Toolbar - Descriptive - List Data - Summary Statistics etc. - Table Analysis etc. Alternative to directly using SAS Procedures 17
Behind the scenes 18
Behind the scenes 19
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 20
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 TAB Description* 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’ * Instructions Required 21
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. 22
I. 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 report Key Point: Access data sets and assign formats 23
II. Data Management Tasks Description_____ Create Query Add variables and formats ex. salegrp, salegrp. Proc SQL 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, 24 useful for ad-hoc requests
Create Query Task: Merge Data Sets A B C ü ü ü ü 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 25
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. 26
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 27
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. 28
Query Exploration and Management Intermediate [Select Variables, Subset Condition, and Sort Order] Datasets LAB 1 • Query 301 and labtest = ‘CHEM_ALB’ • Query 302 and labtest = ‘HEM_ANC’ (DATA step update to LAB 2) LAB 2 • Query 301 and labtest = ‘CHEM_ALB’ • Query 302 and labtest = ‘HEM_ANC’ (DATA step update to LAB) LAB • Characterize Data • Save as permanent dataset Recreate Queries How do you think dates are selected?
Graph Task: Chart Gallery SAS Programming 30
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 across market segments – Retail/Catalog? Organization How successful are the marketing and sales campaign promotions? Once a table is created, it is easy to change the 31 table to a different viewpoint!
Selecting Analysis and Reporting Tasks How well do you know your business? WHICH IS THE BEST ? PRODUCT? - Shoes CUSTOMER? - Acme REGION? - Northern MARKET SEGMENT? - Retail Sales TIME PERIOD? - 4 th Quarter, 2001 PRODUCT GROWTH? - Slippers You’ve got questions, Enterprise Guide has answers! 32
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. continue … 33
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. continue … 34
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. Build Your Own Best Practice Tips 35
SOP Compliance and Best Practices 36
Characterize Data Task – Categorical Data Automatic for both character and numeric variables. Can specify number of unique values to display. 37
Characterize Data Task – Continuous Data Automatic for each numeric variable. 38
Characterize Data Task – Continuous Data Option to display as graphs or save as dataset. 39
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=comma 6. ; define sales / sum 'Total' format=dollar 8. ; define pct_prd / computed '% Total' width=5 format=pctf. ; define grd_tot / sum 'QNTY Total' format=comma 6. ; define grd_pct / sum 'SALES Total' width=5 format=dollar 8. ; compute before; gt 1=_c 3_; gt 2 = _c 6_; gt 3 = _c 8_; endcomp; compute pct_prd; _c 4_ = (_c 3_/gt 1)*100; _c 7_ = (_c 6_/gt 2)*100; endcomp; rbreak after / summarize skip ol ul; compute after; product = 'Total'; endcomp; Yes, you can write run; your own code. 40
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 41
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 Gupta Sunil@Gupta. Programming. com www. SASSavvy. com
- Slides: 46