Data Resource Center
Code library

Behavioral Risk Factor Surveillance System (BRFSS)

SAS/SAS-callable SUDAAN programs

Programs to create estimates published in NOHSS and CDI
Programs to convert data files provided on BRFSS Web site to SAS data files
Example code for SAS and SUDAAN

The code library currently contains programs for use with BRFSS surveys for the years 1999, 2002, and 2004.

The programs:
produce estimates published in the National Oral Health Surveillance System (NOHSS)
produce age-adjusted estimates published in the Chronic Disease Indicators project (CDI)
are written for SAS and SAS-callable SUDAAN
were tested using SAS v8.2 with SAS-callable SUDAAN 9.0.1

Considerations: 
These programs are written for novice SAS and SUDAAN users and do not use macros, thus they are not optimized to conserve computing resources.  The SAS-callable SUDAAN code blocks (beginning "proc crosstab" and "proc descript") ran very slowly in testing (15+ minutes each).  For examples of programs that use macros, consult a SAS user's manual or text book, or see the example program "SAS_SUD99.sas" on the BRFSS Web site under Data and Technical Info, 1999, SAS Resources.  Macros will reduce the running time considerably.  Running the programs a block at a time will help in identifying issues with different software versions or individual user set-ups.

Programs to create estimates published in NOHSS and CDI
(see General Notes about running these programs)

Back to top

Each program:
Creates variables for oral health indicators, demographic categories, and age adjustment
Generates estimates both age-adjusted and unadjusted for indicators:
  past year dental visit (yes, no)
  past year dental cleaning (yes, no)
  complete tooth loss among adults aged 65+ (yes, no)
  lost 6 or more teeth among adults aged 65+ (yes, no)
Includes calculation of 95% confidence intervals, cell sizes, denominators, and flags for unstable estimates based on BRFSS criteria of denominator <50 or confidence interval halfwidth <10.

Year Program Notes
2004 NOHSS2005BRFSS2004_DRC.sas

 

2002 NOHSS2005BRFSS2002_DRC.sas

 

1999 NOHSS2005BRFSS1999_DRC.sas

 

 

Programs to convert data files provided on BRFSS Web site to SAS data files
(see General Notes about running these programs)

Back to top

Year Program
Click to open program in new window.
To download, right-click and choose "Save Target as."
Notes
2004 BRFSS2004_xpt.sas No issues identified in testing
2003 BRFSS2003_xpt.sas No issues identified in testing
2002 BRFSS2002_xpt.sas No issues identified in testing
2001 sasout01_nofmts.sas Program slightly modified from BRFSS program SASOUT01.sas.  Original program available from BRFSS Web site. 
Two variables in sasout01.sas are noted as uninitialized:_AGEG and ALCOHOL2, but were not needed for the oral health analyses.
2000 sasout00_nofmts.sas Program slightly modified from BRFSS program SASOUT00.sas.  Original program available from BRFSS Web site. 
No issues identified in testing
1999 SASOUT99_nofmts.sas Program slightly modified from BRFSS program SASOUT99.sas.  Original program available from BRFSS Web site. 
No issues identified in testing. 
1998 SAS98OUT_nofmts.sas Program slightly modified from BRFSS program SAS98OUT.sas.  Original program available from BRFSS Web site. 
Four variables in input statement noted in SAS log as "uninitialized".  The variables were not needed for the NOHSS and CDI analyses, and may be suppressed in the public release data set.  (The variables were: PHONENUM, AREACODE, PREFIX, SUFFIX)
1997 SASOUT97_nofmts.sas Program slightly modified from BRFSS program SASOUT97.sas.  Original program available from BRFSS Web site. 
No issues identified in testing
1996 SASOUT96_nofmts.sas

Program slightly modified from BRFSS program SASOUT96.sas.  Original program available from BRFSS Web site. 
SAS log notes one label command misspelled as LABLE, but SAS usually assumes it meant LABEL and proceeds with just a warning note.

1995 sasout95_nofmts.sas Program slightly modified from BRFSS program SASOUT95.sas.  Original program available from BRFSS Web site. 
No issues identified in testing

 

Example code for SAS and SUDAAN

Back to top

Example code to convert a SAS transport data file (file extension ".xpt") to a SAS data file (file extension .sas7bdat or .sd7)

/*Program Name: BRFSS2004_xpt.sas*/
/*create SAS v8 file from SAS xport file*/
/*for BRFSS 2004*/
/*07/15/2005*/
LIBNAME BRF04IN XPORT "C:/BRFSS/BRFSS2004/SASXPORT/cdbrfs04.xpt";
libname  BRF04OUT v8 "C:/BRFSS/BRFSS2004/SASV8";
  PROC COPY IN=BRF04IN OUT=BRF04OUT;
  RUN;
/*end BRFSS2004_xpt.sas*/

In the SAS enhanced editor, it will look like this:
(Comments written to document the program appear in green between special symbols "/*" and "*/", or between "*" and ";".):

/*Program Name: BRFSS2004_xpt.sas*/
/*create SAS v8 file from SAS xport file*/
/*for BRFSS 2004*/
/*07/15/2005*/

LIBNAME
BRF04IN XPORT "C:/BRFSS/BRFSS2004/SASXPORT/cdbrfs04.xpt";
libname
BRF04OUT v8 "C:/BRFSS/BRFSS2004/SASV8";
PROC COPY IN=BRF04IN OUT=BRF04OUT;
RUN;
/*end BRFSS2004_xpt.sas*/

Example SAS Data step to recode a variable

Data Brf04ss.BRFDOH04; *write out data set;
set Brf04ss.cdbrfs04;  *read in data set;

*Age groups - 18 and older in 6 groups;
if age in (7,9) then agegrp = . ; *refused, did not respond, missing omitted;
else if 18 <= age <= 24 then agegrp = 1 ; *18 to 24 years;
else if 25 <= age <= 34 then agegrp = 2 ; *25 to 34 years;
else if 35 <= age <= 44 then agegrp = 3 ; *35 to 44 years;
else if 45 <= age <= 54 then agegrp = 4 ; *45 to 54 years;
else if 55 <= age <= 64 then agegrp = 5 ; *55 to 64 years;
else if age ge 65 then agegrp = 6 ; *65 years and older;

RUN;

Example SUDAAN Code block to produce estimates for Past year dental visits for all states, by several demographic groupings

*Table for 2004 Dental visits: 18 and older - Not age adjusted;

Proc
crosstab Data = Brf04ss.BRFDOH04 design=wr filetype=sas CONF_LIM=95;
 Nest _ststr _psu/missunit;
 Weight _finalwt;

 Subpopn agegrp >=
1 and _finalwt>0;
 
Class _state;
 Subgroup visit sex agegrp racegrp income educat ;
 Levels    
2    2    6       5       5     4    ;

 Tables _state*visit
       (sex income educat racegrp agegrp)*_state*visit;

 Print nsum rowper lowrow uprow/ rowperfmt=
f5.1 lowrowfmt=f5.1 uprowfmt=f5.1 style=nchs;
 output nsum rowper lowrow uprow/ filename=brf04ss.vis04 REPLACE filetype=SAS;

 rtitle
"NOHSS 2005 release - BRFSS 2004 Estimates for Dental Visits - not age adjusted";

Run
;
 

General notes about running these programs:

Back to top

Need to have SAS and SAS-callable SUDAAN installed either on local machine or have access to these programs through a network (See About SAS and SAS-callable SUDAAN).  The SAS-callable SUDAAN code in these programs can be copied into a separate file and edited to run in SUDAAN.

Libname BRF99SS 'C:\BRFSS\BRFSS1999\SASV8'; /*Location of SAS version of data set*/
Libname OUT 'C:\BRFSS\BRFSS1999\OUT'; /*Location to save output data sets*/
 

Libname LIBRARY 'C:\BRFSS\BRFSS1999\SASV8'; /*Formats library*/

If you don't want to save permanent formats: 

delete this statement
Libname
LIBRARY 'C:\BRFSS\BRFSS1999\SASV8'; /*Formats library*/

and change this statement
*Formats;

Proc
Format library=LIBRARY; *creates permanent format library;

to this statement
*Formats;

Proc
Format ; *creates temporary format library;
 

*Exporting file to Excel;
Proc
Export Data = Brf97ss.CDIInd92_1997
Outfile = "Q:\BRFSS\Brfss1997\ExcelTables\CDIInd92_1997.xls"
DBMS = Excel2000 Replace;
Run
;