- Author: admin
- Filed under: Auto-cars
- Date: Mar 12,2008
First, you must create the label formats with proc format using a value statement. Next, you attach the label format to the variable with a format statement. This format statement can be used in either proc or data steps. An example of the proc format step for creating the value formats, forgnf and $makef follows.
PROC FORMAT; VALUE forgnf 0=”domestic” 1=”foreign” ; VALUE $makef “AMC” =”American Motors” “Buick” =”Buick (GM)” “Cad.” =”Cadillac (GM)” “Chev.” =”Chevrolet (GM)” “Datsun” =”Datsun (Nissan)”;RUN;
You may include any number of value statements to create label formats as needed. Since make is a variable that contains character values, when you define the formats for it you have to precede the format name with a $ so the format name becomes $makef. Additionally, for character variables the values of the variables must be enclosed in quotes.
Read the rest of this entry »
- Author: admin
- Filed under: Auto-cars
- Date: Mar 12,2008
Creating variable labels We use the label statement in the data step to assign labels to the variables. You could also assign labels to variables in proc steps, but then the labelsonly exist for that step. When labels are assigned in the data step they are available for all procedures that use that data set.
The following program assigns variable labels to rep78, mpg and foreign.
DATA auto2; SET auto; LABEL rep78 =”1978 Repair Record” mpg =”Miles Per Gallon” foreign=”Where Car Was Made”;RUN;PROC CONTENTS DATA=auto2;RUN; Read the rest of this entry »