Notes7 4pp

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: Examine the descriptor portion of the st.dfwlax data set. proc contents data=st.dfwlax; run; The SAS System Partial Output Obs Alphabetic List of Variables and Attributes # Variable Type Len 2 3 5 4 1 Date Dest Economy FirstClass Flight Num Char Num Num Char 8 3 8 8 3 Format Label MMDDYY10. Destination Economy Passengers First Class Passengers Flight 1 2 3 4 5 6 7 8 9 10 439 921 114 982 439 982 431 982 114 982 Date 12/11/2000 12/11/2000 12/12/2000 12/12/2000 12/13/2000 12/13/2000 12/14/2000 12/14/2000 12/15/2000 12/15/2000 Destination First Class Passengers Economy Passengers LAX DFW LAX dfw LAX DFW LaX DFW LAX DFW 20 20 15 5 14 15 17 7 . 14 137 131 170 85 196 116 166 88 187 31 21 22 Override Permanent Attributes Use a FORMAT statement in a PROC step to temporarily override the format stored in the data set descriptor. Lab Exercises 6 proc print data=st.dfwlax label; format Date date9.; run; Exercise 2: Assigning Variable Attributes 23 24 6 Override Permanent Attributes The DATASETS Procedure The SAS System Obs Flight 1 2 3 4 5 6 7 8 9 10 439 921 114 982 439 982 431 982 114 982 Date 11DEC2000 11DEC2000 12DEC2000 12DEC2000 13DEC2000 13DEC2000 14DEC2000 14DEC2000 15DEC2000 15DEC2000 Destination First Class Passengers LAX DFW LAX dfw LAX DFW LaX DFW LAX DFW 20 20 15 5 14 15 17 7 . 14 You can use the DATASETS procedure to modify a variable’s • name • label • format • informat. Economy Passengers 137 131 170 85 196 116 166 88 187 31 25 The DATASETS Procedure 26 Data Set Contents General form of PROC DATASETS for changing variable attributes: Use the DATASETS procedure to change the name of the variable Dest to Destination. PROC DATASETS LIBRARY=libref ; MODIFY SAS-data-set ; RENAME old-name-1=new-name-1 <. . . old-name-n=new-name-n>; LABEL variable-1='label-1' <. . . variable-n='label-n'>; FORMAT variable-list-1 format-1 <. . . variable-list-n format-n>; INFORMAT variable-list-1 informat-1 <. . . variable-list-n informat-n>; RUN; Look at the attributes of the variables in the st.dfwlax data set. proc contents data=st.dfwlax; run; Alphabetic List of Variables and Attributes # Type Len 2 3 5 4 1 27 Variable Date Dest Economy FirstClass Flight Num Char Num Num Char 8 3 8 8 3 28 7 The DATASETS Procedure Data Set Contents Look at the attributes of the variables in the st.dfwlax data set after running PROC DATASETS. Rename the variable Dest to Destination. proc datasets library=st; modify dfwlax; rename Dest=Destination; run; proc contents data=st.dfwlax; run; Alphabetic List of Variables and Attributes # 29 Variable Type Len 2 3 5 4 1 Date Destination Economy FirstClass Flight Num Char Num Num Char 8 3 8 8 3 30 8...
View Full Document

This note was uploaded on 09/25/2013 for the course STAT 440 taught by Professor Muyot,m during the Fall '08 term at University of Illinois, Urbana Champaign.

Ask a homework question - tutors are online