SAS Certification Handout #10: Adv. Prog. Ch. 5-8
|
|
- Amie Patrick
- 6 years ago
- Views:
Transcription
1 SAS Certification Handout #10: Adv. Prog. Ch. 5-8 /************ Ch. 5 ******************* /* First, make example data -- same as Handout #9 libname cert 'C:/jrstevens/Teaching/SAS_Cert/AdvNotes'; /* In SAS Studio, after creating SAS_Cert folder with username jrstevens: libname cert '/home/jrstevens/sas_cert'; data cert.sales10; format LastName $9. Sales dollar8.; input LastName $ EmplID Division $ Sales; cards; Smith 315 A Nelson 333 A Uribe 612 C Larson 331 B Larsen 216 B Rasmussen 217 A Knecht 861 B D'Angelou 772 A Larson 331 C ; /* CREATE TABLE -- three ways: (1) from query (as before; pp ) (2) empty table from scratch (pp ) (3) empty table LIKE existing table (pp ) /* (1) CREATE TABLE from query (pp ) create table work.temp1 as select * from cert.sales10; /* no output, but LOG: Table WORK.TEMP1 created, with 4 rows and 4 columns. /* (2) CREATE TABLE as empty table from scratch (pp ) create table work.temp2 (LastName char(9) format=$9., EmplID num, Division char(1), Sales num format=dollar8.); /* no output, but LOG: NOTE: Table WORK.TEMP2 created, with 0 rows and 4 columns. 1
2 /* (3) CREATE TABLE LIKE existing table (pp ) create table work.temp3 like cert.sales10; /* no output, but LOG: NOTE: Table WORK.TEMP3 created, with 0 rows and 4 columns. /* NOTE: To existing (sometimes empty) tables, can later INSERT rows (p. 189) in three ways: (i) SET (by column name; pp ) (ii) VALUES (as lists of values; pp ) (iii) SELECT (from a query; pp ) /* (i) INSERT rows by column name; pp insert into work.temp3 set LastName='Smith', EmplID=315, Division='A', Sales=553312; proc print data=temp3; run; Obs LastName Sales EmplID Division 1 Smith $553, A /* (ii) INSERT rows by list of values; Note that order of column values need not match order in table insert into work.temp3(lastname, EmplID, Division, Sales) values('nelson', 333, 'A', ) values('uribe', 612, 'C', ); Obs LastName Sales EmplID Division proc print data=temp3; run; 1 Smith $553, A 2 Nelson $555, A 3 Uribe $867, C /* (iii) INSERT rows from a query insert into work.temp3 select * from cert.sales10 where LastName='Knecht'; proc print data=temp3; run; Obs LastName Sales EmplID Division 1 Smith $553, A 2 Nelson $555, A 3 Uribe $867, C 4 Knecht $983, B 2
3 /* pp Integrity constraints preserve data validity: CHECK, NOT NULL, UNIQUE, FOREIGN KEY, PRIMARY KEY (both NOT NULL and UNIQUE) Can also name constraints. create table work.temp2 ( LastName char(9) format=$9. not null, EmplID num primary key, Division char(1) check(division in ('A','B','C')), Sales num format=dollar8., constraint pos_sales check (Sales ge 0) ); /* LOG: NOTE: Table WORK.TEMP2 created, with 0 rows and 4 columns. /* What happens if try to insert bad row? insert into work.temp2 set LastName='Smith', EmplID=315, Division='A', Sales= set LastName='Nelson', EmplID=333, Division='D', Sales= ; /* LOG refers to first CHECK failed (Division here) for at least one inserted row, so no rows are inserted. ERROR: Add/Update failed for data set WORK.TEMP2 because data value(s) do not comply with integrity constraint _CK0001_ proc print data=temp2; run;/* No output because 0 rows /* Force inclusion of valid rows with UNDO_POLICY=NONE (pp ) proc sql undo_policy=none; insert into work.temp2 set LastName='Smith', EmplID=315, Division='A', Sales= set LastName='Nelson', EmplID=333, Division='D', Sales= ; proc print data=temp2; run; Obs LastName EmplID Division Sales 2 Smith 315 A $553,312 3
4 /* UPDATE... SET... with same expression (pp ) (Suppose two employees transferred divisions) create table work.temp4 as select EmplID, Division from cert.sales10; update work.temp4 set Division = 'B' where EmplID in (772, 612); proc print data=temp4; run; Obs EmplID Division A A B B B A B B C /* UPDATE... SET... with different expression (pp ) using CASE... WHEN... THEN... <ELSE>... END This is kind of like SELECT... END in Base chapter 10, but more flexible. (Suppose all divisions restructured) create table work.temp4 as select EmplID, Division from cert.sales10; update work.temp4 set Division = case when EmplID in (772, 612) then 'B' when EmplID in (315, 333, 216) then 'A' else 'C' end; proc print data=temp4; run; Obs EmplID Division A A B C A C C B C /* See very efficient CASE example on p
5 /* Can also delete rows (DELETE FROM... WHERE... ; pp ) and add/drop/modify columns (ALTER TABLE ; pp ). Suppose an employee retired and for all remaining employees, their automatic bonus must be reported. create table work.temp4 as select * from cert.sales10; delete from work.temp4 where emplid = 612; alter table work.temp4 add bonus num format=dollar9.2 drop Division modify Sales label='total Annual Sales'; update work.temp4 set bonus =.005*Sales; proc print data=temp4 label; run; Obs LastName Total Annual Sales EmplID bonus 1 Smith $553, $2, Nelson $555, $2, Larson $521, $2, Larsen $123, $ Rasmussen $125, $ Knecht $983, $4, D'Angelou $332, $1, Larson $381, $1, /* To see table definition/composition (including constraints) without reporting all of it, use DESCRIBE TABLE (pp. 182, ); kind of like PROC CONTENTS describe table work.temp4; /* LOG: NOTE: SQL table WORK.TEMP4 was created like: create table WORK.TEMP4( bufsize=65536 ) ( LastName char(9) format=$9., Sales num format=dollar8. label='total Annual Sales', EmplID num, bonus num format=dollar9.2 ); 5
6 /************ Ch. 6 ******************* /* Recall 'indexed' example on p. 10 of Handout #3: focus on efficiency when searching large data sets. p. 240: index stores unique values (and their location in table) for specified column(s). pp : indexes can be helpful but expensive. p. 239: if table is indexed, don't need to search row-by-row such as when using WHEN clause p. 240: It's only worth it to index a table for LARGE data, for columns with many distinct values, and when <15% of rows may be selected for a given query /* p : CREATE INDEX... ON... create index nameind on cert.sales10(emplid, Division); describe table cert.sales10; run; /* LOG: create table cert.sales10( bufsize=65536 ) ( LastName char(9) format=$9., Sales num format=dollar8., EmplID num, Division char(8) ); create index nameind on cert.sales10(emplid,division); /* p. 248: OPTIONS MSGLEVEL=I to check if used. pp : can force or suppress usage of index (using IDXWHERE or IDXNAME), but usually best to let SAS choose (more efficient) select * from cert.sales10 where division='a' & emplid=333; /* no mention of index in LOG LastName Sales EmplID Division options msglevel=i; Nelson $555, A select * from cert.sales10 where division='a' & emplid=333; /* LOG: INFO: Index nameind selected for WHERE clause optimization. options msglevel=n; /* reset 6
7 /* p. 252: DROP INDEX... FROM... drop index nameind from cert.sales10; /* LOG: NOTE: Index nameind has been dropped. /************ Ch. 7 ******************* /* p. 261: PROC SQL view like a pointer (descriptor and other info to retrieve data) to SAS or DBMS files; biggest benefits are to save space (because view just points, doesn't contain data), to protect data (can restrict access to certain columns or rows only included in view), and to ensure users have most current data (because underlying table file can be updated, automatically propogating to all views for downstream users) /* p. 262: CREATE VIEW... AS SELECT... FROM... pp : can treat a view as a table or data set create view cert.tview as select LastName, EmplID, Division from cert.sales10 where division='a'; /* no output, but LOG: NOTE: SQL view WORK.TVIEW has been defined. Creates a tview.sas7bvew file that is MUCH smaller than the cert.sales10 file select * from cert.tview; LastName EmplID Division Smith 315 A Nelson 333 A Rasmussen 217 A D'Angelou 772 A proc print data=cert.tview; run; Obs LastName EmplID Division 1 Smith 315 A 2 Nelson 333 A 3 Rasmussen 217 A 4 D'Angelou 772 A 7
8 /* p. 265: DESCRIBE VIEW -- just like DESCRIBE TABLE (like PROC CONTENTS); DESCRIBE TABLE with a view gives error in LOG describe view cert.tview; /* LOG: NOTE: SQL view cert.tview is defined as: select * from cert.sales10 where division = 'A'; /* p. 266: default LIBREF and embedded USING LIBNAME create view cert.tview as select LastName, EmplID, Division from sales10 /* default LIBREF is same as view's (CERT here) where division='a' using libname cert 'C:/jrstevens/Teaching/SAS_Cert/AdvNotes'; /* in SAS Studio, something like '/home/jrstevens/sas_cert' /* LOG: NOTE: SQL view CERT.TVIEW has been defined. /* pp : UPDATE will actually change the table file (not just the report in SAS) update cert.tview set Division="" where LastName='Rasmussen'; select * from cert.sales10 where LastName='Rasmussen'; LastName Sales EmplID Division Rasmussen $125, /* p. 270: DROP VIEW -- actually deletes the tview.sas7bvew file drop view cert.tview; 8
9 /************ Ch. 8 ******************* /* Options inside PROC SQL statement: INOBS and OUTOBS (p. 280) affect number of read-in and reported rows NUMBER (p. 282) adds column of row number to report STIMER NOSTIMER (p. 286; with PROC OPTIONS, too) sends run-time (statement-wise and total) to LOG DOUBLE (p. 282, for double-spacing) and FLOW (p , for word-wrapping) don't affect HTML output RESET to add/drop/change options in the middle of an SQL execution (p ) LastName Sales EmplID Division Smith $553, A proc options option=stimer value; run; Nelson $555, A D'Angelou $332, A proc sql inobs=10 outobs=3 stimer; select * from cert.sales10 where division='a'; reset number; select * from cert.sales10 where division='b'; Row LastName Sales EmplID Division 1 Larson $521, B 2 Larsen $123, B 3 Knecht $983, B 232 proc sql inobs=10 outobs=3 stimer; NOTE: SQL Statement used (Total process time): real time cpu time 233 select * from cert.sales10 where division='a'; NOTE: SQL Statement used (Total process time): real time cpu time 234 reset number; NOTE: SQL Statement used (Total process time): real time cpu time 235 select * from cert.sales10 where division='b'; NOTE: SQL Statement used (Total process time): real time 0.01 seconds cpu time 236 NOTE: PROCEDURE SQL used (Total process time): real time cpu time 9
10 /* "Dictionary tables", or tables in the DICTIONARY library: summaries of all available libraries, tables, macros, and external files (pp ) -- accessible through SQL queries or sashelp views /* salary10 data cert.salary10; format Salary dollar10.2; input ID Salary; cards; ; proc print data=cert.salary10; run; Obs Salary ID 1 $54, $68, $89, /* Suppose I want to find all variables in all cert library datasets with dollar-related format /* Look inside COLUMNS table describe table dictionary.columns; /* LOG: NOTE: SQL table DICTIONARY.COLUMNS was created like: create table DICTIONARY.COLUMNS ( libname char(8) label='library Name', memname char(32) label='member Name', memtype char(8) label='member Type', name char(32) label='column Name', type char(4) label='column Type', length num label='column Length', npos num label='column Position', varnum num label='column Number in Table', label char(256) label='column Label', format char(49) label='column Format', informat char(49) label='column Informat', idxusage char(9) label='column Index Type', sortedby num label='order in Key Sequence', xtype char(12) label='extended Type', notnull char(3) label='not NULL?', precision num label='precision', scale num label='scale', transcode char(3) label='transcoded?' ); 10
11 select memname, libname, name, format from dictionary.columns where format contains 'DOLLAR' and libname='cert'; /* Note that libname is in all caps Member Name Library Name Column Name Column Format SALARY10 CERT Salary DOLLAR10.2 SALARY8 CERT Salary DOLLAR8. SALARY9 CERT Salary DOLLAR8. SALES10 CERT Sales DOLLAR8. SALES8 CERT Sales DOLLAR8. SALES9 CERT Sales DOLLAR8. /* equivalent but slower: proc print data=sashelp.vcolumn; var memname libname name format; where format contains 'DOLLAR' and libname='cert'; run; Obs memname libname name format 11 SALARY10 CERT Salary DOLLAR SALARY8 CERT Salary DOLLAR8. 17 SALARY9 CERT Salary DOLLAR8. 20 SALES10 CERT Sales DOLLAR8. 24 SALES8 CERT Sales DOLLAR8. 31 SALES9 CERT Sales DOLLAR8. 11
12 /* See pp for list of available tables in DICTIONARY library 12
SAS Certification Handout #8: Adv. Prog. Ch. 1-2
/* First, make example data SAS Certification Handout #8: Adv. Prog. Ch. 1-2 libname cert 'C:/jrstevens/Teaching/SAS_Cert/AdvNotes' /* In SAS Studio, after creating SAS_Cert folder with username jrstevens:
More informationSAS Certification Handout #9: Adv. Prog. Ch. 3-4
SAS Certification Handout #9: Adv. Prog. Ch. 3-4 /************ Ch. 3 ********************/ /* First, make example data -- similar to Handout #8 */ libname cert 'C:/jrstevens/Teaching/SAS_Cert/AdvNotes';
More informationUncommon Techniques for Common Variables
Paper 11863-2016 Uncommon Techniques for Common Variables Christopher J. Bost, MDRC, New York, NY ABSTRACT If a variable occurs in more than one data set being merged, the last value (from the variable
More informationSAS Certification Handout #11: Adv. Prog. Ch. 9-10
SAS Certification Handout #11: Adv. Prog. Ch. 9-10 /************ Ch. 9 ********************/ /* SAS Macros -- like writing your own functions in SAS; especially useful for reproducing analyses or reports
More informationTop 5 Handy PROC SQL Tips You Didn t Think Were Possible
Top 5 Handy PROC SQL Tips You Didn t Think Were Possible Montreal SAS users Group 30 May 2018 11:00-11:40 Charu Shankar SAS Institute, Toronto About your presenter SAS Senior Technical Training Specialist,
More informationSQL Metadata Applications: I Hate Typing
SQL Metadata Applications: I Hate Typing Hannah Fresques, MDRC, New York, NY ABSTRACT This paper covers basics of metadata in SQL and provides useful applications, including: finding variables on one or
More informationDictionary.coumns is your friend while appending or moving data
ABSTRACT SESUG Paper CC-41-2017 Dictionary.coumns is your friend while appending or moving data Kiran Venna, Dataspace Inc. Dictionary.columns is a dictionary table, which gives metadata information of
More informationDavid Ghan SAS Education
David Ghan SAS Education 416 307-4515 David.ghan@sas.com Using SQL in SAS Victoria Area SAS User Group February 12, 2004 1. What is SQL? 2. Coding an SQL Query 3. Advanced Examples a. Creating macro variables
More informationKnow Thy Data : Techniques for Data Exploration
Know Thy Data : Techniques for Data Exploration Montreal SAS Users Group Wednesday, 29 May 2018 13:50-14:30 PM Andrew T. Kuligowski, Charu Shankar AGENDA Part 1- Easy Ways to know your data Part 2 - Powerful
More informationAbstract. Introduction. How Are All of These Tables Related? - Relational Database Map - RDB_MAP.SAS
How Are All of These Tables Related? - Relational Database Map - RDB_MAPSAS Eric Losby, HealthCare COMPARE Corp, Downers Grove, IL Abstract This simple, yet highly useful SAS program generates a "relational
More informationKnow Thy Data: Techniques for Data Exploration
Know Thy Data: Techniques for Data Exploration Andrew T. Kuligowski, HSN Charu Shankar, SAS Canada ABSTRACT Get to know the #1 rule for data specialists: Know thy data. Is it clean? What are the keys?
More informationA Better Perspective of SASHELP Views
Paper PO11 A Better Perspective of SASHELP Views John R. Gerlach, Independent Consultant; Hamilton, NJ Abstract SASHELP views provide a means to access all kinds of information about a SAS session. In
More informationwork.test temp.test sasuser.test test
DSCI 325 Midterm Practice Test Spring 2017 Name: 1. Consider the following four names used to create a SAS data set: work.test temp.test sasuser.test test How many of these will be stored as permanent
More informationContents of SAS Programming Techniques
Contents of SAS Programming Techniques Chapter 1 About SAS 1.1 Introduction 1.1.1 SAS modules 1.1.2 SAS module classification 1.1.3 SAS features 1.1.4 Three levels of SAS techniques 1.1.5 Chapter goal
More informationABSTRACT. Paper CC-031
Paper CC-031 Using Functions SYSFUNC and IFC to Conditionally Execute Statements in Open Code Ronald J. Fehd, Centers for Disease Control and Prevention, Atlanta, GA, USA ABSTRACT Audience Keywords Information
More informationAn SQL Tutorial Some Random Tips
An SQL Tutorial Some Random Tips Presented by Jens Dahl Mikkelsen SAS Institute A/S Author: Paul Kent SAS Institute Inc, Cary, NC. Short Stories Towards a Better UNION Outer Joins. More than two too. Logical
More informationSample Questions. SAS Advanced Programming for SAS 9. Question 1. Question 2
Sample Questions The following sample questions are not inclusive and do not necessarily represent all of the types of questions that comprise the exams. The questions are not designed to assess an individual's
More informationDavid Beam, Systems Seminar Consultants, Inc., Madison, WI
Paper 150-26 INTRODUCTION TO PROC SQL David Beam, Systems Seminar Consultants, Inc., Madison, WI ABSTRACT PROC SQL is a powerful Base SAS Procedure that combines the functionality of DATA and PROC steps
More informationTen Great Reasons to Learn SAS Software's SQL Procedure
Ten Great Reasons to Learn SAS Software's SQL Procedure Kirk Paul Lafler, Software Intelligence Corporation ABSTRACT The SQL Procedure has so many great features for both end-users and programmers. It's
More informationProgramming & Manipulation. Danger: MERGE Ahead! Warning: BY Variable with Multiple Lengths! Bob Virgile Robert Virgile Associates, Inc.
Danger: MERGE Ahead! Warning: BY Variable with Multiple Lengths! Bob Virgile Robert Virgile Associates, Inc. Overview Normally, when a data step merges two data sets, any common variables will have the
More informationMimicking the Data Step Dash and Double Dash in PROC SQL Arlene Amodeo, Law School Admission Council, Newtown, PA
ABSTRACT Mimicking the Data Step Dash and Double Dash in PROC SQL Arlene Amodeo, Law School Admission Council, Newtown, PA The SQL procedure is a powerful and versatile procedure in SAS that allows the
More informationSame Data Different Attributes: Cloning Issues with Data Sets Brian Varney, Experis Business Analytics, Portage, MI
Paper BB-02-2013 Same Data Different Attributes: Cloning Issues with Data Sets Brian Varney, Experis Business Analytics, Portage, MI ABSTRACT When dealing with data from multiple or unstructured data sources,
More informationSAS Certification Handout #6: Ch
SAS Certification Handout #6: Ch. 16-18 /************ Ch. 16 ******************* /* Suppose we have numeric variables ModelNumber Price Weight Change and date variable Date, plus a string variable Designer
More informationTaming a Spreadsheet Importation Monster
SESUG 2013 Paper BtB-10 Taming a Spreadsheet Importation Monster Nat Wooding, J. Sargeant Reynolds Community College ABSTRACT As many programmers have learned to their chagrin, it can be easy to read Excel
More informationOpen Problem for SUAVe User Group Meeting, November 26, 2013 (UVic)
Open Problem for SUAVe User Group Meeting, November 26, 2013 (UVic) Background The data in a SAS dataset is organized into variables and observations, which equate to rows and columns. While the order
More informationSAS Certification Handout #5: Ch /************ Ch. 13 ********************/ /* NOTE: Ch. 13 presents loads of functions; see pp.
SAS Certification Handout #5: Ch. 13-15 /************ Ch. 13 ********************/ /* NOTE: Ch. 13 presents loads of functions see pp. 452-455 */ /* MEAN function */ data a5 input X1-X5 Xmeans = mean(of
More informationSAS Certification Handout #7: Ch
SAS Certification Handout #7: Ch. 19-21 /************ Ch. 19 ********************/ /* Consider a mailing list example, partial from http://mlb.mlb.com/team/ 1---+----10---+----20---+ Kansas City Royals
More informationPlanting Your Rows: Using SAS Formats to Make the Generation of Zero- Filled Rows in Tables Less Thorny
Planting Your Rows: Using SAS Formats to Make the Generation of Zero- Filled Rows in Tables Less Thorny Kathy Hardis Fraeman, United BioSource Corporation, Bethesda, MD ABSTRACT Often tables or summary
More informationChapter 2: Getting Data Into SAS
Chapter 2: Getting Data Into SAS Data stored in many different forms/formats. Four categories of ways to read in data. 1. Entering data directly through keyboard 2. Creating SAS data sets from raw data
More informationDatabase Programming with SQL
Database Programming with SQL 2-1 Objectives This lesson covers the following objectives: Apply the concatenation operator to link columns to other columns, arithmetic expressions, or constant values to
More informationPaper B GENERATING A DATASET COMPRISED OF CUSTOM FORMAT DETAILS
Paper B07-2009 Eliminating Redundant Custom Formats (or How to Really Take Advantage of Proc SQL, Proc Catalog, and the Data Step) Philip A. Wright, University of Michigan, Ann Arbor, MI ABSTRACT Custom
More informationTOP 10 (OR MORE) WAYS TO OPTIMIZE YOUR SAS CODE
TOP 10 (OR MORE) WAYS TO OPTIMIZE YOUR SAS CODE Handy Tips for the Savvy Programmer SAS PROGRAMMING BEST PRACTICES Create Readable Code Basic Coding Recommendations» Efficiently choosing data for processing»
More informationINTERMEDIATE SQL GOING BEYOND THE SELECT. Created by Brian Duffey
INTERMEDIATE SQL GOING BEYOND THE SELECT Created by Brian Duffey WHO I AM Brian Duffey 3 years consultant at michaels, ross, and cole 9+ years SQL user What have I used SQL for? ROADMAP Introduction 1.
More informationTop 10 Ways to Optimize Your SAS Code Jeff Simpson SAS Customer Loyalty
Top 10 Ways to Optimize Your SAS Code Jeff Simpson SAS Customer Loyalty Writing efficient SAS programs means balancing the constraints of TIME Writing efficient SAS programs means balancing Time and SPACE
More informationSo, Your Data are in Excel! Ed Heaton, Westat
Paper AD02_05 So, Your Data are in Excel! Ed Heaton, Westat Abstract You say your customer sent you the data in an Excel workbook. Well then, I guess you'll have to work with it. This paper will discuss
More informationData Set Options CHAPTER 2
5 CHAPTER 2 Data Set Options Definition 6 6 Using Data Set Options 6 Using Data Set Options with Input or Output SAS Data Sets 6 How Data Set Options Interact with System Options 7 Data Set Options by
More informationWHAT ARE SASHELP VIEWS?
Paper PN13 There and Back Again: Navigating between a SASHELP View and the Real World Anita Rocha, Center for Studies in Demography and Ecology University of Washington, Seattle, WA ABSTRACT A real strength
More informationThe Power of PROC SQL Techniques and SAS Dictionary Tables in Handling Data
Paper PO31 The Power of PROC SQL Techniques and SAS Dictionary Tables in Handling Data MaryAnne DePesquo Hope, Health Services Advisory Group, Phoenix, Arizona Fen Fen Li, Health Services Advisory Group,
More informationSAS Institute Exam A SAS Advanced Programming Version: 6.0 [ Total Questions: 184 ]
s@lm@n SAS Institute Exam A00-212 SAS Advanced Programming Version: 6.0 [ Total Questions: 184 ] Question No : 1 The report will not successfully run and will produce an error message in the log. What
More informationCSE 530A. ER Model to Relational Schema. Washington University Fall 2013
CSE 530A ER Model to Relational Schema Washington University Fall 2013 Relational Model A relational database consists of a group of relations (a.k.a., tables) A relation (table) is a set of tuples (rows)
More informationGet Going with PROC SQL Richard Severino, Convergence CT, Honolulu, HI
Get Going with PROC SQL Richard Severino, Convergence CT, Honolulu, HI ABSTRACT PROC SQL is the SAS System s implementation of Structured Query Language (SQL). PROC SQL can be used to retrieve or combine/merge
More informationUsing a Control Dataset to Manage Production Compiled Macro Library Curtis E. Reid, Bureau of Labor Statistics, Washington, DC
AP06 Using a Control Dataset to Manage Production Compiled Macro Library Curtis E. Reid, Bureau of Labor Statistics, Washington, DC ABSTRACT By default, SAS compiles and stores all macros into the WORK
More informationBetter Metadata Through SAS II: %SYSFUNC, PROC DATASETS, and Dictionary Tables
Paper 3458-2015 Better Metadata Through SAS II: %SYSFUNC, PROC DATASETS, and Dictionary Tables ABSTRACT Louise Hadden, Abt Associates Inc., Cambridge, MA SAS provides a wealth of resources for users to
More informationWhy Is This Subject Important? You Could Look It Up: An Introduction to SASHELP Dictionary Views. What Information is Listed in Dictionary Tables?
You Could Look It Up: An Introduction to SASHELP Dictionary Views Michael L. Davis Bassett Consulting Services, Inc. September 13, 2000 Why Is This Subject Important? many experienced SAS users have never
More informationSQL: A COMMERCIAL DATABASE LANGUAGE. Complex Constraints
SQL: A COMMERCIAL DATABASE LANGUAGE Complex Constraints Outline 1. Introduction 2. Data Definition, Basic Constraints, and Schema Changes 3. Basic Queries 4. More complex Queries 5. Aggregate Functions
More informationAn Introduction to PROC SQL. David Beam Systems Seminar Consultants, Inc. - Madison, WI
An Introduction to PROC SQL David Beam Systems Seminar Consultants, Inc. - Madison, WI Abstract PROC SQL is a powerful Base SAS PROC which combines the functionality of the DATA and PROC Steps into a single
More informationINDEX. 1 Basic SQL Statements. 2 Restricting and Sorting Data. 3 Single Row Functions. 4 Displaying data from multiple tables
INDEX Exercise No Title 1 Basic SQL Statements 2 Restricting and Sorting Data 3 Single Row Functions 4 Displaying data from multiple tables 5 Creating and Managing Tables 6 Including Constraints 7 Manipulating
More informationCOMM 391. Objectives. Introduction to Microsoft Access. What is in an Access database file? Introduction to Microsoft Access 2010
Objectives COMM 391 Introduction to Management Information Systems Introduction to Microsoft Access 2010 Describe the major objects in Access database. Define field, record, table and database. Navigate
More informationRetrieving Data Using the SQL SELECT Statement. Copyright 2004, Oracle. All rights reserved.
Retrieving Data Using the SQL SELECT Statement Copyright 2004, Oracle. All rights reserved. Objectives After completing this lesson, you should be able to do the following: List the capabilities of SQL
More informationACCESS Procedure Reference
59 CHAPTER 5 ACCESS Procedure Reference Introduction 59 Case Sensitivity in the ACCESS Procedure 60 ACCESS Procedure 60 Description 61 PROC ACCESS Statement Options 62 Options 62 SAS System Passwords for
More informationDBLOAD Procedure Reference
131 CHAPTER 10 DBLOAD Procedure Reference Introduction 131 Naming Limits in the DBLOAD Procedure 131 Case Sensitivity in the DBLOAD Procedure 132 DBLOAD Procedure 132 133 PROC DBLOAD Statement Options
More informationGetting Familiar with SAS Version 8.2 and 9.0 Enhancements Sunil K. Gupta, Gupta Programming, Simi Valley, CA
Getting Familiar with SAS Version 8.2 and 9.0 Enhancements Sunil K. Gupta, Gupta Programming, Simi Valley, CA ABSTRACT Are you just getting around to realizing what SAS version 8.2 has to offer while recently
More informationPreserving your SAS Environment in a Non-Persistent World. A Detailed Guide to PROC PRESENV. Steven Gross, Wells Fargo, Irving, TX
Preserving your SAS Environment in a Non-Persistent World A Detailed Guide to PROC PRESENV Steven Gross, Wells Fargo, Irving, TX ABSTRACT For Enterprise Guide users, one of the challenges often faced is
More informationStat Wk 3. Stat 342 Notes. Week 3, Page 1 / 71
Stat 342 - Wk 3 What is SQL Proc SQL 'Select' command and 'from' clause 'group by' clause 'order by' clause 'where' clause 'create table' command 'inner join' (as time permits) Stat 342 Notes. Week 3,
More informationNetworks and Web for Health Informatics (HINF 6220)
Networks and Web for Health Informatics (HINF 6220) Tutorial #1 Raheleh Makki Email: niri@cs.dal.ca Tutorial Class Timings Tuesday & Thursday 4:05 5:25 PM Course Outline Database Web Programming SQL PHP
More informationPaper DB2 table. For a simple read of a table, SQL and DATA step operate with similar efficiency.
Paper 76-28 Comparative Efficiency of SQL and Base Code When Reading from Database Tables and Existing Data Sets Steven Feder, Federal Reserve Board, Washington, D.C. ABSTRACT In this paper we compare
More informationMaintaining Data 3.3.1
Maintaining Data Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 4.0.3 3.3.1 Unit Objectives After completing this unit, you should be able to: Create
More informationOracle Database 10g Express
Oracle Database 10g Express This tutorial prepares the Oracle Database 10g Express Edition Developer to perform common development and administrative tasks of Oracle Database 10g Express Edition. Objectives
More informationWorking with Columns, Characters and Rows. Copyright 2008, Oracle. All rights reserved.
Working with Columns, Characters and Rows What Will I Learn? In this lesson, you will learn to: Apply the concatenation operator to link columns to other columns, arithmetic expressions or constant values
More information10 The First Steps 4 Chapter 2
9 CHAPTER 2 Examples The First Steps 10 Invoking the Query Window 11 Changing Your Profile 11 ing a Table 13 ing Columns 14 Alias Names and Labels 14 Column Format 16 Creating a WHERE Expression 17 Available
More informationExploring DICTIONARY Tables and SASHELP Views
Exploring DICTIONARY Tables and SASHELP Views Kirk Paul Lafler, Software Intelligence Corporation Abstract SAS users can quickly and conveniently obtain useful information about their SAS session with
More informationGIFT Department of Computing Science Data Selection and Filtering using the SELECT Statement
GIFT Department of Computing Science [Spring 2013] CS-217: Database Systems Lab-2 Manual Data Selection and Filtering using the SELECT Statement V1.0 4/12/2016 Introduction to Lab-2 This lab reinforces
More informationHandout 6 CS-605 Spring 18 Page 1 of 7. Handout 6. Physical Database Modeling
Handout 6 CS-605 Spring 18 Page 1 of 7 Handout 6 Physical Database Modeling Purpose- translate the logical description of data into the technical specifications for storing and retrieving data Goal - create
More informationWhy Relational Databases? Relational databases allow for the storage and analysis of large amounts of data.
DATA 301 Introduction to Data Analytics Relational Databases Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca DATA 301: Data Analytics (2) Why Relational Databases? Relational
More informationCreate Metadata Documentation using ExcelXP
Paper AD13 Create Metadata Documentation using ExcelXP Christine Teng, Merck Research Labs, Merck & Co., Inc., Rahway, NJ ABSTRACT The purpose of the metadata documentation is two-fold. First, it facilitates
More informationWhy choose between SAS Data Step and PROC SQL when you can have both?
Paper QT-09 Why choose between SAS Data Step and PROC SQL when you can have both? Charu Shankar, SAS Canada ABSTRACT As a SAS coder, you've often wondered what the SQL buzz is about. Or vice versa you
More informationRESTRICTING AND SORTING DATA
RESTRICTING AND SORTING DATA http://www.tutorialspoint.com/sql_certificate/restricting_and_sorting_data.htm Copyright tutorialspoint.com The essential capabilities of SELECT statement are Selection, Projection
More informationSASe vs OB2 as a Relational DBMS for End Users: Three Corporations with Three Different Solutions Stephen C. Scott, Scott Consulting Services, Inc.
SASe vs OB2 as a Relational DBMS for End Users: Three Corporations with Three Different Solutions Stephen C. Scott, Scott Consulting Services, Inc. i; ;~ ABSTRACT: Three corporations with different sizes
More informationOptimizing System Performance
243 CHAPTER 19 Optimizing System Performance Definitions 243 Collecting and Interpreting Performance Statistics 244 Using the FULLSTIMER and STIMER System Options 244 Interpreting FULLSTIMER and STIMER
More informationCIS Reading Packet: "Views, and Simple Reports - Part 1"
CIS 315 - Reading Packet: "Views, and Simple Reports - Part 1" p. 1 CIS 315 - Reading Packet: "Views, and Simple Reports - Part 1" Sources: * Oracle9i Programming: A Primer, Rajshekhar Sunderraman, Addison
More informationPosters. Workarounds for SASWare Ballot Items Jack Hamilton, First Health, West Sacramento, California USA. Paper
Paper 223-25 Workarounds for SASWare Ballot Items Jack Hamilton, First Health, West Sacramento, California USA ABSTRACT As part of its effort to insure that SAS Software is useful to its users, SAS Institute
More informationBasic Concept Review
Basic Concept Review Quiz Using the Programming Workspace Referencing Files and Setting Options Editing and Debugging SAS Programs End of Review SAS Format Format Formats are variable
More informationWhat Is SAS? CHAPTER 1 Essential Concepts of Base SAS Software
3 CHAPTER 1 Essential Concepts of Base SAS Software What Is SAS? 3 Overview of Base SAS Software 4 Components of the SAS Language 4 SAS Files 4 SAS Data Sets 5 External Files 5 Database Management System
More informationValidation Summary using SYSINFO
Validation Summary using SYSINFO Srinivas Vanam Mahipal Vanam Shravani Vanam Percept Pharma Services, Bridgewater, NJ ABSTRACT This paper presents a macro that produces a Validation Summary using SYSINFO
More informationAdvanced SQL GROUP BY Clause and Aggregate Functions Pg 1
Advanced SQL Clause and Functions Pg 1 Clause and Functions Ray Lockwood Points: s (such as COUNT( ) work on groups of Instead of returning every row read from a table, we can aggregate rows together using
More informationCS Reading Packet: "Views, and Simple Reports - Part 1"
CS 325 - Reading Packet: "Views, and Simple Reports - Part 1" p. 1 Sources: CS 325 - Reading Packet: "Views, and Simple Reports - Part 1" * Oracle9i Programming: A Primer, Rajshekhar Sunderraman, Addison
More informationCS352 Lecture: Integrity and Security Constraints revised 9/8/06
CS352 Lecture: Integrity and Security Constraints revised 9/8/06 Materials: 1. Handout of SQL statements for creating example library database, showing entity and referential integrity constraints. (Students
More informationInformation Systems Engineering. SQL Structured Query Language DDL Data Definition (sub)language
Information Systems Engineering SQL Structured Query Language DDL Data Definition (sub)language 1 SQL Standard Language for the Definition, Querying and Manipulation of Relational Databases on DBMSs Its
More informationThe Relational Model. Chapter 3. Comp 521 Files and Databases Fall
The Relational Model Chapter 3 Comp 521 Files and Databases Fall 2012 1 Why Study the Relational Model? Most widely used model by industry. IBM, Informix, Microsoft, Oracle, Sybase, etc. It is simple,
More informationMOBILE MACROS GET UP TO SPEED SOMEWHERE NEW FAST Author: Patricia Hettinger, Data Analyst Consultant Oakbrook Terrace, IL
MOBILE MACROS GET UP TO SPEED SOMEWHERE NEW FAST Author: Patricia Hettinger, Data Analyst Consultant Oakbrook Terrace, IL ABSTRACT: Have you ever been faced with this scenario? It s your first day on the
More informationCPS221 Lecture: Relational Database Querying and Updating
CPS221 Lecture: Relational Database Querying and Updating last revised 8/5/10 Objectives: 1. To introduce the SQL select statement 2. To introduce the SQL insert, update, and delete statements Materials:
More informationGreenspace: A Macro to Improve a SAS Data Set Footprint
Paper AD-150 Greenspace: A Macro to Improve a SAS Data Set Footprint Brian Varney, Experis Business Intelligence and Analytics Practice ABSTRACT SAS programs can be very I/O intensive. SAS data sets with
More informationCOMP283-Lecture 6 Applied Database Management
Applied Database Management Introduction Database Administration More Optimisation Maintaining Data Integrity Improving Performance 1 DB Administration: Full-text index Full Text Index Index large text
More informationCPS221 Lecture: Relational Database Querying and Updating
CPS221 Lecture: Relational Database Querying and Updating Objectives: last revised 10/29/14 1. To introduce the SQL select statement 2. To introduce the SQL insert, update, and delete statements Materials:
More informationA Hands-on Introduction to SAS Dictionary Tables
Paper HW10-2014 A Hands-on Introduction to SAS Dictionary Tables Peter Eberhardt, Fernwood Consulting Group Inc., Toronto Canada ABSTRACT SAS maintains a wealth of information about the active SAS session,
More informationCalculating Cardinality Ratio in Two Steps
MWSUG 2016 Paper TT03 Calculating Cardinality Ratio in Two Steps Ronald J. Fehd, Stakana Analytics Abstract Description: Purpose: Audience: Keywords: The cardinality of a set is the number of elements
More informationINTERNATIONAL INDIAN SCHOOL, RIYADH XI XII BOYS SECTION. Subject- Informatics Practices
Grade- XI INTERNATIONAL INDIAN SCHOOL, RIYADH XI XII BOYS SECTION Unit 1 Programming and Computational Thinking Chapter 1 Introduction to Computer Systems 1. What are the functions of computer? 2. What
More informationRETRIEVING DATA USING THE SQL SELECT STATEMENT
RETRIEVING DATA USING THE SQL SELECT STATEMENT Course Objectives List the capabilities of SQL SELECT statements Execute a basic SELECT statement Development Environments for SQL Lesson Agenda Basic SELECT
More informationA Practical Introduction to SAS Data Integration Studio
ABSTRACT A Practical Introduction to SAS Data Integration Studio Erik Larsen, Independent Consultant, Charleston, SC Frank Ferriola, Financial Risk Group, Cary, NC A useful and often overlooked tool which
More informationRetrieving Data Using the SQL SELECT Statement. Copyright 2004, Oracle. All rights reserved.
Retrieving Data Using the SQL SELECT Statement Objectives After completing this lesson, you should be able to do the following: List the capabilities of SQL SELECT statements Execute a basic SELECT statement
More informationChapter 1 The DATA Step
Chapter 1 The DATA Step 1.1 Structure of SAS Programs...1-3 1.2 SAS Data Sets... 1-12 1.3 Creating a Permanent SAS Data Set... 1-18 1.4 Writing a SAS DATA Step... 1-24 1.5 Creating a DATA Step View...
More informationIBM A Assessment: DB2 9 Fundamentals-Assessment. Download Full Version :
IBM A2090-730 Assessment: DB2 9 Fundamentals-Assessment Download Full Version : http://killexams.com/pass4sure/exam-detail/a2090-730 C. 2 D. 3 Answer: C QUESTION: 294 In which of the following situations
More informationAn Easier and Faster Way to Untranspose a Wide File
Paper 2419-2018 An Easier and Faster Way to Untranspose a Wide File Arthur S. Tabachneck, Ph.D., AnalystFinder, Inc. Matthew Kastin, NORC at the University of Chicago Joe Matise, NORC at the University
More informationThe SERVER Procedure. Introduction. Syntax CHAPTER 8
95 CHAPTER 8 The SERVER Procedure Introduction 95 Syntax 95 Syntax Descriptions 96 Examples 101 ALLOCATE SASFILE Command 101 Syntax 101 Introduction You invoke the SERVER procedure to start a SAS/SHARE
More informationSYSTEM 2000 Essentials
7 CHAPTER 2 SYSTEM 2000 Essentials Introduction 7 SYSTEM 2000 Software 8 SYSTEM 2000 Databases 8 Database Name 9 Labeling Data 9 Grouping Data 10 Establishing Relationships between Schema Records 10 Logical
More informationHow to Create Data-Driven Lists
Paper 9540-2016 How to Create Data-Driven Lists Kate Burnett-Isaacs, Statistics Canada ABSTRACT As SAS programmers we often want our code or program logic to be driven by the data at hand, rather than
More informationDeveloping Data-Driven SAS Programs Using Proc Contents
Developing Data-Driven SAS Programs Using Proc Contents Robert W. Graebner, Quintiles, Inc., Kansas City, MO ABSTRACT It is often desirable to write SAS programs that adapt to different data set structures
More informationAPPENDIX 4 Migrating from QMF to SAS/ ASSIST Software. Each of these steps can be executed independently.
255 APPENDIX 4 Migrating from QMF to SAS/ ASSIST Software Introduction 255 Generating a QMF Export Procedure 255 Exporting Queries from QMF 257 Importing QMF Queries into Query and Reporting 257 Alternate
More informationDatabase Management Systems Paper Solution
Database Management Systems Paper Solution Following questions have been asked in GATE CS exam. 1. Given the relations employee (name, salary, deptno) and department (deptno, deptname, address) Which of
More informationUSING DATA TO SET MACRO PARAMETERS
USING DATA TO SET MACRO PARAMETERS UPDATE A PREVIOUS EXAMPLE %macro report(regs=); %let r=1; %let region=%scan(®s,&r); %do %until(®ion eq ); options nodate pageno=1; ods pdf file="®ion..pdf";
More information