Name firstnamefirst name salaryannual salary format

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: alary='Annual Salary'; format Jobcode $codefmt. Salary money.; title1 'Salary Report in Categories'; run; Salary Report in Categories Emp ID Last Name 0031 0040 0071 0082 0091 0106 0355 0366 GOLDENBERG WILLIAMS PERRY MCGWIERMCGWIER-WATTS SCOTT THACKER BELL GLENN First Name JobCode DESIREE ARLENE M. ROBERT A. CHRISTINA HARVEY F. DAVID S. THOMAS B. MARTHA S. Pilot Pilot Flight Flight Flight Flight Pilot Pilot Flight Flight Flight Flight Pilot Pilot Pilot Pilot Annual Salary More More than Attendant Less than Attendant Less than More More than Attendant 25,000 to Attendant Less than More More than More than 50,000 25,000 25,000 50,000 50,000 25,000 50,000 50,000 12 3 Default Variable Attributes When a variable is created in a DATA step, the • name, type, and length of the variable are automatically assigned • remaining attributes such as label and format are not automatically assigned. Lab Exercises 6 Exercise 1: Creating and Applying User-defined Formats When the variable is used in a later step, • the name is displayed for identification purposes • its value is displayed using a systemdetermined format. 13 14 Default Variable Attributes Default Variable Attributes Examine the descriptor portion of the st.dfwlax data set. Create the st.dfwlax data set. proc contents data=st.dfwlax; run; libname st 'D:\Stat 440'; data st.dfwlax; infile 'D:\Stat 440\dfwlax.dat'; input @1 Flight $3. @4 Date mmddyy8. @12 Dest $3. @15 FirstClass 3. @18 Economy 3.; run; Partial Output Alphabetic List of Variables and Attributes # Type Len 2 3 5 4 1 15 Variable Date Dest Economy FirstClass Flight Num Char Num Num Char 8 3 8 8 3 16 4 Temporary Variable Attributes Specifying Variable Attributes Use LABEL and FORMAT statements in the • PROC step to temporarily assign the attributes (for the duration of the step only) • DATA step to permanently assign the attributes (stored in the data set descriptor portion). Use LABEL and FORMAT statements in a PROC step to temporarily assign attributes. proc print data=st.dfwlax label; format Date mmddyy10.; label Dest='Destination' FirstClass='First Class Passengers' Economy='Economy Passengers'; run; 17 Temporary Variable Attributes Permanent Variable Attributes 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 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 18 Assign labels and formats in the DATA step. 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 libname st 'D:\Stat 440'; data st.dfwlax; infile 'raw-data-file'; input @1 Flight $3. @4 Date mmddyy8. @12 Dest $3. @15 FirstClass 3. @18 Economy 3.; format Date mmddyy10.; label Dest='Destination' FirstClass='First Class Passengers' Economy='Economy Passengers'; run; 19 20 5 Permanent Variable Attributes Permanent Variable Attributes proc print data=st.dfwlax label; run;...
View Full Document

Ask a homework question - tutors are online