BookmarkSubscribeRSS Feed
oldeks
Calcite | Level 5

Most previous posts around this subject are from 2019 or before so maybe something has changed. I have uploaded the BRFSS data zip file but can't figure out how to make the data accessible for use. When I tried to import, it says the file is invalid. I am using SAS studio for Academics online. 

4 REPLIES 4
Kurt_Bremser
Super User
Files in a ZIP archive need a two-step approach:
first, define a FILENAME for the ZIP file
then, in the DATA step you write to read the data, use the file reference and the name of the contained file as a member (see documentation of the INFILE statement)
ballardw
Super User

Did you download zip files of text or of SAS data sets? I think that if the file contains SAS data sets then unzip and create a library pointing to the folder where the files were unzipped would work.

 

If the zip contains text files to read then unzip and use the programs to read the files that were likely at the location you downloaded the data sets.

Tom
Super User Tom
Super User

They publish a lot of files. What files in particular did you download?

 

When I look at for example the 2024 data files.

https://www.cdc.gov/brfss/annual_data/annual_2024.html

 

There are two ZIP files.  One contains the RAW text file of the data.  You will need to read that file using a SAS data step. Which they also provide.  If that is the file you retrieved show what issues you had with using their program to read the file.

 

The other has a V5 SAS transport file.  For SAS code to read that you will need to expand it first.  You can have SAS do it into a temporary file in the directory using by the WORK library of your current session.

filename brfss zip '~/LLCP2024XPT.zip' member='*' lrecl=80 recfm=f;

filename xpt "%sysfunc(pathname(work))/llcp2024.xpt" lrecl=80 recfm=f;
%put RC=%sysfunc(fcopy(brfss,xpt));

libname brfss xport "%sysfunc(pathname(work))/llcp2024.xpt";
proc copy inlib=brfss outlib=work;
run;
 NOTE: Input library BRFSS is sequential.
 NOTE: Copying BRFSS.LLCP2024 to WORK.LLCP2024 (memtype=DATA).
 NOTE: BUFSIZE is not cloned when copying across different engines. System Option for BUFSIZE was used.
 NOTE: There were 457670 observations read from the data set BRFSS.LLCP2024.
 NOTE: The data set WORK.LLCP2024 has 457670 observations and 301 variables.
 NOTE: PROCEDURE COPY used (Total process time):
       real time           4.46 seconds
       cpu time            4.43 seconds
oldeks
Calcite | Level 5
It's the 2022 SAS transport file.

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore Now →

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 501 views
  • 0 likes
  • 4 in conversation