Chapter Contents |
Previous |
Next |
Formatting Variables and Values |
Enter PROC FORMAT statements in the Program Editor. |
Choose Run:Submit. |
Select YR_MAJOR. |
Choose Edit:Formats:Other. |
This displays the Format Dialog.
Enter YEARFMT in the Name field. |
Enter 12 in the w field, then press the Return key. |
Now the example in the upper right of the dialog shows a value
formatted with YEARFMT.
Click OK to close the Format dialog. |
Now YEARFMT is used to display the values of YR_MAJOR.
By default, the new format is used to display values wherever you use YR_MAJOR. Formats are not used in calculations except for nominal variables in model effects or for group variables. In these cases, the format is used to determine the groups. You can see this use of formats by creating a box plot.
Deselect YR_MAJOR in the data window. |
Choose Analyze:Box Plot/Mosaic Plot ( Y ). |
This displays the box plot variables dialog.
Assign YR_MAJOR the X role and CR_HITS the Y role. |
Click the OK button to create the box plot. |
Since YEARFMT defines four formatted values, there are four boxes in the box plot. One of the boxes has no whiskers because it represents only two observations. Pete Rose and Tony Perez, ballplayers of exceptional hitting ability and longevity, are in a class by themselves.
To learn more about SAS formats, refer to SAS Language Reference: Dictionary. To learn more about creating your own formats with PROC FORMAT, refer to the SAS Procedures Guide.
Related Reading | Box Plots, Chapter 33. |
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.