How do I use the SAS
format library?
The SAS format library contains the formats used to make
SAS output more readable. Formats are linked to the data so
that results are displayed as words (“Male” or “Female”, for
instance) instead of numbers (1 or 2). The SAS YRBS data
file is designed to use its companion format library. You
should download both the data file and the format library if
you want to use SAS to analyze YRBS data.
The following example SAS program shows how to use the format library. It assumes that both the data file and the format library have been downloaded to “c:\data”. Note that the program contains two libname statements. The first libname statement indicates where the data file is located; the second libname statement indicates where the format library is located.
libname mydata 'c:\data'; /* tells SAS where
the data are */
options fmtsearch=(mydata.XXH2010_formats); /*
tells SAS where the
formats are */
proc freq data=mydata.XXH2010_YRBS_DATA;
tables q2;
run; |
Using the format library is recommended but technically
is optional. If you do not want to use the format library,
include the following statement at the start of your SAS
program:
options nofmterr; /*
tells SAS to not
look for formats */ |
Please note that each year of YRBS data has its own
format library. Format libraries are not the same across
years of data.