Proc print dataworksubset3 label run data worksubset3

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 07d04 Partial PROC PRINT Output Obs 1 2 3 4 5 6 7 8 9 10 61 Tom Wilson Irenie Christina Kimiko Lucian Fong Satyakam Sharryn Monica Zhou Dawes Elvish Ngan Hotstone Daymond Hofmeister Denny Clarkson Kletschkus Sales Title Sales Sales Sales Sales Sales Sales Sales Sales Sales Sales Manager Manager Rep. II Rep. II Rep. I Rep. I Rep. IV Rep. II Rep. II Rep. IV Salary Date Hired $108,255 $87,975 $26,600 $27,475 $26,190 $26,480 $32,040 $26,780 $28,100 $30,890 JUN1989 JAN1974 JAN1974 JUL1978 OCT1985 MAR1979 MAR1979 AUG2006 NOV1998 NOV2006 p107d04 Missing Values in the Middle of the Record The WHERE statement is used to obtain a subset of observations from an input data set. The WHERE statement cannot be used to select records from a raw data file. Each record in phone2.csv has a contact name, phone number, and a mobile number. The phone number is missing from some of the records. phone2.csv The subsetting IF can subset data that is in the PDV. Missing data is indicated by two consecutive delimiters. 1 1 2 2 3 3 4 4 1---5----0----5----0----5----0----5----0----5 James Kvarniq,(704) 293-8126,(701) 281-8923 Sandrina Stephano,, (919) 271-4592 Cornelia Krahl,(212) 891-3241,(212) 233-5413 Karen Ballinger,, (714) 644-9090 Elke Wallstab,(910) 763-5561,(910) 545-3421 .SAS 64 63 7.05 Quiz Unexpected Results Open and submit p107a01. Examine the SAS log. How many input records were read and how many observations were created? The missing phone numbers caused unexpected results in the output. PROC PRINT Output Name James Kvarniq Sandrina Stephano Karen Ballinger data contacts; length Name $ 20 Phone Mobile $ 14; infile 'phone2.csv' dlm=','; input Name $ Phone $ Mobile $; run; Phone 293(704) 293-8126 871(919) 871-7830 (714) 344-4321 344- Mobile 281(701) 281-8923 Cornelia Krahl Elke Wallstab Partial SAS Log NOTE: 5 records were read from the infile 'phone2.csv'. The minimum record length was 31. The maximum record length was 44. NOTE: SAS went to a new line when INPUT statement reached past the end of a line. NOTE: The data set WORK.CONTACTS has 3 observations and 3 variables. proc print data=contacts noobs; run; 65 Last_Name 62 Additional SAS Statements Where only works for the SAS data sets which ends with IF can be used to the raw data sets like Csv. First_ Name 66 11 Consecutive Delimiters in List Input The DSD Option By default, list input treats two or more consecutive delimiters as a single delimiter and not treated as a missing value. The DSD option for the INFILE statement sets the default delimiter to a comma treats consecutive delimiters as missing values enables SAS to read values with embedded delimiters if the value is surrounded by quotation marks. phone2.csv The two consecutive commas are not being read as a missing value. 1 1 2 2 3 3 4 4 1---5----0----5----0----5----0----5----0----5 James Kvarniq,(704) 293-8126,(701) 281-8923 Sandrina Stephano,, (919) 271-4592 Cornelia Krahl,(212) 891-3241,(212) 233-5413 Karen Ballinger,, (714) 644-9090 Elke Wallstab,(910) 763-5561,(910) 545-3421 General form of a DSD option in an INFILE statement: INFILE 'raw-data-file-name' DSD; 67 67 68 Using the DSD Option delimiter sensitive data Resu...
View Full Document

This document was uploaded on 02/25/2014 for the course STAT 410 at University of Illinois, Urbana Champaign.

Ask a homework question - tutors are online