Lecture3 - Review of Lecture 2 LIBNAME statement (purpose...

Info iconThis preview shows pages 1–14. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Review of Lecture 2 • LIBNAME statement (purpose to create the permanent SAS data) • KEEP, DROP, WHERE statement (DATA step) •VAR statement (PRINT procedure)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 * LIBNAME : Temporal link to the directory. Source data - P:/math2871/donations.sas7bdat Output data – Temporal data called subset1 Create a permanent data called subset1, save in Desktop. (P:/Deaktop/subset1.sas7bdat) libname orion ‘P: \ math2871’; data work.subset1; set orion .sales; run; libname job ‘P: \ Desktop’; data job .subset1; set orion .sales; run;
Background image of page 2
3 Clear libref General form of cleaing libref is LIBNAME libref CLEAR;
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Use of LIBNAME Example: libname orion ‘P: \ math2871’; libname math ‘C: \ Desktop’; data math.subset1; set orion.sales; where Salary<50000; run; data math.subset2 (keep=Last_Name); set orion.customer_dim; run; libname orion clear; libname math clear; creating libref clearing libref
Background image of page 4
5 Selecting Variables You can use a DROP= or KEEP= option in a DATA statement to control what variables are written to the new SAS data set. General form of the DROP= and KEEP= data set options SAS-data-set ( DROP= variables ) or SAS-data-set ( KEEP= variables )
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 DROP= and KEEP= data set options in a DATA statement are similar to DROP and KEEP statements . is equivalent to data work.subset1; set orion.sales; keep First_Name Last_Name Salary Job_Title Hire_Date; run; data work.subset1 (keep First_Name Last_Name Salary Job_Title Hire_Date); set orion.sales; run;
Background image of page 6
7 Requesting Column Totals The SUM statement produces column totals. General form of the SUM statement: The SUM statement also produces subtotals if you print the data in groups. SUM variable(s) ;
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 Requesting Column Totals Example: Produce the total of Salary variable. proc print data = work.subset1; var First_Name Last_Name Salary Job_Title Hire_Date; sum Salary; run;
Background image of page 8
9 Chapter 5: Reading SAS Data Sets 5.1 Introduction to Reading Data 5.2 Using SAS Data as Input 5.3 Subsetting Observations and Variables 5.4 Adding Permanent Attributes
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10 Objectives Add labels to the descriptor portion of a SAS data set by using the LABEL statement. Add formats to the descriptor portion of a SAS data set by using the FORMAT statement.
Background image of page 10
11 LIBNAME libref ' SAS-data-library ' ; DATA output-SAS-data-set ; SET input-SAS-data-set ; WHERE where-expression ; KEEP variable-list ; RUN; Business Scenario Syntax Use the following statements to complete the scenario: Part 1 Part 2 Part 3
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
12 Adding Permanent Attributes The descriptor portion of the SAS data set stores variable attributes including the name, type (character or numeric), and length of the variable. Labels and formats can also be stored in the descriptor portion. Partial PROC CONTENTS Output Alphabetic List of Variables and Attributes # Variable Type Len Format Label 1 First_Name Char 12 5 Hire_Date Num 8 DDMMYY10. Date Hired 4 Job_Title Char 25 Sales Title 2 Last_Name Char 18 3 Salary Num 8 COMMAX8.
Background image of page 12
13 Adding Permanent Attributes When displaying reports, a label changes the appearance of a variable name a format changes the appearance of variable value.
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 14
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/12/2011 for the course ASB 1001,2522, taught by Professor Nicole during the One '09 term at University of New South Wales.

Page1 / 60

Lecture3 - Review of Lecture 2 LIBNAME statement (purpose...

This preview shows document pages 1 - 14. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online