PROC FORMAT

     Use SAS' PROC FORMAT to assign character values to numeric variables.  Here is an example.


PROC FORMAT; VALUE wgt 1='Obese' 2='Overweight' 3='Normal';
  VALUE dir 1='Ascending' 2='Descending'; VALUE dev 1='stairs' 2='escalate'; run;
data lotus; input weight direct device freq;
FORMAT weight wgt. direct dir. device dev. ;
cards;
data were here
proc freq; tables direct*device weight*direct*device / chisq nopercent nocol;
  weight freq; run;


    Do notice that you use one VALUE statement for each format you wish to define. In each VALUE statement you give the format a name and then define the values. PROC FORMAT creates formats, but it does not apply them. To apply a format, you use the FORMAT statement. Put the FORMAT statement in the DATA step if you wish the format used with all procedures that follow. Put it in the PROC step if you wish it used with only one procedure. In the FORMAT statement you list the one or more variables to be formatted, followed by the format name. Notice that the name of the format is followed by a period in the FORMAT statement, but not in the PROC FORMAT statement You may list more than one format, each associated with the one or more variables named before it.

Back to the SAS Help Page

Visit Karl's Index Page


Contact Information for the Webmaster,
Dr. Karl L. Wuensch



This page most recently revised on 26. October 2005.