Trouble loading data from the Behavioral Risk Factor Surveillance System

Reply
Occasional Contributor
Posts: 14

Trouble loading data from the Behavioral Risk Factor Surveillance System

I am having trouble downloading the 2014 data from the BRFSS website. I am getting an error message that says "LIBRARY DATAOUT IS NOT IN A VALID FORMAT FOR ACCESS METHOD RANDOM". Does anyone know what that means and how I can fix it. I have placed

*****************************************************************************************
* FILE NAME:     SASOUT14_LLCP.SAS                                                      *
* DESCRIPTION:   THIS PROGRAM CONVERTS A STATES ASCII DATAFILE OF COMPLETES LOCATED AT  *
*                <DATAIN> FILEREF, INTO A SAS DATABASE STORED AT <DATAOUT> LIBREF       *
* REFERENCES:                                                                           *
* INPUT       DATAIN           FILEREF OF ASCII DATAFILE OF COMPLETES                   *
* FORMATS     FORMATS.SAS7BCAT      SAS FORMATS DATABASE                                *
* OUTPUT      DATAOUT.SASDATA  SAS DATABASE VERSION OF ASCII DATA AS SPECIFIED IN       *
*                              <DATAIN> FILEREF                                         *
* UPDATED - 08/06/2015                                                                  *
*****************************************************************************************;
********************************
* Clear Output and Log Windows *
********************************;
DM OUTPUT 'clear' continue;
DM LOG    'clear' continue;
**********************************
* DEFINE SAS ENVIRONMENT OPTIONS *
**********************************;
OPTIONS PAGENO=1 NOFMTERR;
***************************************
* CLEAR EXISTING TITLES AND FOOTNOTES *
***************************************;
TITLE ;
FOOTNOTE ;
RUN ;
******************************************************************
* INSTRUCTIONS:                                                  *
* SPECIFY PATH OF WHERE ASCII DATAFILE IS STORED                 *
* SPECIFY PATH OF WHERE SAS DATASET IS TO BE STORED              *
* SPECIFY PATH OF WHERE SAS FORMAT LIBRARY IS STORED             *
* SPECIFY PATH OF WHERE THE FORMAT ASSIGNMET STATEMENT IS STORED *
******************************************************************;

FILENAME DATAIN 'F:\Analyzing Health Surveys\LLCP2014.ASC' LRECL = 2293 ;
*****************************************************************************
* EXAMPLE:                                                                  *
*       FILENAME DATAIN 'C:\BRFSS\2014\LLCP2014.ASC' LRECL = 2293           *
* NOTE: MAKE SURE THE ASTERISK IS REMOVED BEFORE THE WORD FILENAME AND      *
*       MAKE SURE THAT THE GREATER THAN AND LESS THAN SIGNS < > ARE REMOVED *
*       FROM THE FILENAME STATEMENT                                         *
*****************************************************************************;

LIBNAME DATAOUT V7 'F:\Analyzing Health Surveys\SASDATA.sas7bdat'  ;
*****************************************************************************
* EXAMPLE:                                                                  *
*          LIBNAME DATAOUT 'C:\'                 \                           *
*          A SAS DATABASE WILL BE STORED AT C:\SASDATA.sas7bdat             *
* NOTE: MAKE SURE THE ASTERISK IS REMOVED BEFORE THE WORD LIBNAME AND       *
*       MAKE SURE THAT THE GREATER THAN AND LESS THAN SIGNS < > ARE REMOVED *
*       FROM THE LIBNAME STATEMENT                                          *
*****************************************************************************;

LIBNAME LIBRARY 'F:\Analyzing Health Surveys' ;
*****************************************************************************
* EXAMPLE:                                                                  *
*          LIBNAME LIBRARY 'C:\'                                            *
* NOTE: MAKE SURE THE ASTERISK IS REMOVED BEFORE THE WORD LIBNAME AND       *
*       MAKE SURE THAT THE GREATER THAN AND LESS THAN SIGNS < > ARE REMOVED *
*       FROM THE LIBNAME STATEMENT                                          *
*****************************************************************************;

FILENAME FORMATIN 'F:\Analyzing Health Surveys\format14.sas' ;
*****************************************************************************
* EXAMPLE:                                                                  *
*          FILENAME FORMATIN 'C:\FORMATSTATEMENT.SAS'                       *
* NOTE: MAKE SURE THE ASTERISK IS REMOVED BEFORE THE WORD FILENAME AND      *
*       MAKE SURE THAT THE GREATER THAN AND LESS THAN SIGNS < > ARE REMOVED *
*       FROM THE FILENAME STATEMENT                                         *
*****************************************************************************;

DATA DATAOUT.SASDATA ;
INFILE DATAIN MISSOVER ;
INPUT
_STATE        1-2                     /* Record Identification */
FMONTH        16-17
IDATE         $18-25
IMONTH        $18-19
IDAY          $20-21
IYEAR         $22-25
DISPCODE      31-34
SEQNO         35-44
_PSU          35-44
CTELENUM      62
PVTRESD1      63
COLGHOUS      64
STATERES      65
LADULT        67
NUMADULT      68-69
NUMMEN        70-71
NUMWOMEN      72-73
GENHLTH       80                      /* Section 1: Health Status */
PHYSHLTH      81-82                   /* Section 2: Healthy Days — Health Related Quality of Life */
MENTHLTH      83-84
POORHLTH      85-86
HLTHPLN1      87                      /* Section 3: Health Care Access */
PERSDOC2      88
MEDCOST       89
CHECKUP1      90
EXERANY2      91                      /* Section 4: Exercise */
SLEPTIM1      92-93                   /* Section 5: Inadequate Sleep */
CVDINFR4      94                      /* Section 6: Chronic Health Conditions */
CVDCRHD4      95
CVDSTRK3      96
ASTHMA3       97
ASTHNOW       98
CHCSCNCR      99
CHCOCNCR      100
CHCCOPD1      101
HAVARTH3      102
ADDEPEV2      103
CHCKIDNY      104
DIABETE3      105
DIABAGE2      106-107
LASTDEN3      108                     /* Section 7: Oral Health */
RMVTETH3      109
VETERAN3      146
MARITAL       147
CHILDREN      148-149
EDUCA         150
EMPLOY1       151
INCOME2       152-153
WEIGHT2       154-157
HEIGHT3       158-161
NUMHHOL2      170
NUMPHON2      171
CPDEMO1       172
INTERNET      176
RENTHOM1      177
SEX           178
PREGNANT      179
QLACTLM2      180
USEEQUIP      181
BLIND         182
DECIDE        183
DIFFWALK      184
DIFFDRES      185
DIFFALON      186
SMOKE100      187                     /* Section 9: Tobacco Use */
SMOKDAY2      188
STOPSMK2      189
LASTSMK2      190-191
USENOW3       192
ALCDAY5       193-195                 /* Section 10: Alcohol Consumption */
AVEDRNK2      196-197
DRNK3GE5      198-199
MAXDRNKS      200-201
FLUSHOT6      202                     /* Section 11: Immunization */
FLSHTMY2      203-208
PNEUVAC3      209
SHINGLE2      210
FALL12MN      211-212                 /* Section 12: Falls */
FALLINJ2      213-214
SEATBELT      215                     /* Section 13: Seatbelt Use */
DRNKDRI2      216-217                 /* Section 14: Drinking and Driving */
HADMAM        218                     /* Section 15: Breast and Cervical Cancer Screening */
HOWLONG       219
PROFEXAM      220
LENGEXAM      221
HADPAP2       222
LASTPAP2      223
HADHYST2      224
PCPSAAD2      225                     /* Section 16: Prostate Cancer Screening */
PCPSADI1      226
PCPSARE1      227
PSATEST1      228
PSATIME       229
PCPSARS1      230
BLDSTOOL      231                     /* Section 17: Colorectal Cancer Screening */
LSTBLDS3      232
HADSIGM3      233
HADSGCO1      234
LASTSIG3      235
HIVTST6       236                     /* Section 18: HIV/AIDS */
HIVTSTD3      237-242
WHRTST10      243-244
PDIABTST      255                     /* Module 1: Pre-Diabetes */
PREDIAB1      256
INSULIN       257                     /* Module 2: Diabetes */
BLDSUGAR      258-260
FEETCHK2      261-263
DOCTDIAB      264-265
CHKHEMO3      266-267
FEETCHK       268-269
EYEEXAM       270
DIABEYE       271
DIABEDU       272
PAINACT2      273-274                 /* Module 3: Healthy Days (Symptoms) */
QLMENTL2      275-276
QLSTRES2      277-278
QLHLTH2       279-280
MEDICARE      281                     /* Module 4: Health Care Access */
HLTHCVR1      282-283
DELAYMED      284
DLYOTHER      $285-309
NOCOV121      310
LSTCOVRG      311
DRVISITS      312-313
MEDSCOST      314
CARERCVD      315
MEDBILL1      316
ASBIALCH      317                     /* Module 5: Alcohol Screening & Brief Intervention (ASBI) */
ASBIDRNK      318
ASBIBING      319
ASBIADVC      320
ASBIRDUC      321
WTCHSALT      322                     /* Module 6: Sodium or Salt-Related Behavior */
LONGWTCH      323-325
DRADVISE      326
ASTHMAGE      327-328                 /* Module 7: Adult Asthma History */
ASATTACK      329
ASERVIST      330-331
ASDRVIST      332-333
ASRCHKUP      334-335
ASACTLIM      336-338
ASYMPTOM      339
ASNOSLEP      340
ASTHMED3      341
ASINHALR      342
IMFVPLAC      343-344                 /* Module 8: Influenza */
TETANUS       345                     /* Module 9: Tetanus Diphtheria (TDAP) (Adults) */
HPVTEST       346                     /* Module 10: Adult Human Papilloma Virus (HPV) - Testing */
HPLSTTST      347
HPVADVC2      348                     /* Module 11: Adult Human Papilloma Virus (HPV) - Vaccination */
HPVADSHT      349-350
CNCRDIFF      351                     /* Module 12: Cancer Survivorship */
CNCRAGE       352-353
CNCRTYP1      354-355
CSRVTRT1      356
CSRVDOC1      357-358
CSRVSUM       359
CSRVRTRN      360
CSRVINST      361
CSRVINSR      362
CSRVDEIN      363
CSRVCLIN      364
CSRVPAIN      365
CSRVCTL1      366
RRCLASS2      367                     /* Module 13: Reactions to Race */
RRCOGNT2      368
RRATWRK2      369
RRHCARE3      370
RRPHYSM2      371
RREMTSM2      372
SCNTMNY1      573                     /* Module 15: Social Context */
SCNTMEL1      574
SCNTPAID      575
SCNTWRK1      576-577
SCNTLPAD      578
SCNTLWK1      579-580
SCNTVOT1      581
SXORIENT      582                     /* Module 16: Sexual Orientation and Gender Identity */
TRNSGNDR      583
RCSBIRTH      $584-589                /* Module 17: Random Child Selection */
RCSGENDR      590
RCHISLA1      $591-594
RCSRACE1      $595-622
RCSBRAC1      623-624
RCSRLTN2      625
CASTHDX2      626                     /* Module 18: Childhood Asthma Prevalence */
CASTHNO2      627
EMTSUPRT      628                     /* Module 19: Emotional Support and Life Satisfaction */
LSATISFY      629
CTELNUM1      632                     /* Cell Phone Introduction */
CELLFON2      633
CADULT        634
PVTRESD2      635
CCLGHOUS      636
CSTATE        637
LANDLINE      640
HHADULT       641-642
QSTVER        645-646                 /* Questionnaire Version */
QSTLANG       647-648                 /* Questionnaire Language */
MSCODE        1356
_STSTR        1357-1362
_STRWT        1363-1372
_RAWRAKE      1393-1402
_WT2RAKE      1403-1412
_AGE80        1417-1418
_IMPRACE      1419-1420
_IMPNPH       1421
_IMPEDUC      1425
_IMPMRTL      1426
_IMPHOME      1427
_CHISPNC      1612                    /* Child Demographic Variables */
_CPRACE       1669-1670
_CRACE1       1671-1672
_IMPCAGE      1673
_IMPCRAC      1674
_IMPCSEX      1675
_CLLCPWT      1802-1811
_DUALUSE      1938
_DUALCOR      1939-1948
_LLCPWT2      1949-1958
_LLCPWT       2007-2016
_RFHLTH       2155                    /* Section 1: Calculated Variables */
_HCVU651      2156                    /* Section 3: Calculated Variables */
_TOTINDA      2157                    /* Section 4: Calculated Variables */
_LTASTH1      2158                    /* Section 6: Calculated Variables */
_CASTHM1      2159
_ASTHMS1      2160
_DRDXAR1      2161
_EXTETH2      2162                    /* Section 7: Oral Health */
_ALTETH2      2163
_DENVST2      2164
_PRACE1       2221-2222
_MRACE1       2223-2224
_HISPANC      2227
_RACE         2228
_RACEG21      2229
_RACEGR3      2230
_RACE_G1      2231
_AGEG5YR      2232-2233
_AGE65YR      2234
_AGE_G        2235
HTIN4         2236-2238
HTM4          2239-2241
WTKG3         2242-2246
_BMI5         2247-2250
_BMI5CAT      2251
_RFBMI5       2252
_CHLDCNT      2253
_EDUCAG       2254
_INCOMG       2255
_SMOKER3      2256                    /* Section 9: Calculated Variables */
_RFSMOK3      2257
DRNKANY5      2258                    /* Section 10: Calculated Variables */
DROCDY3_      2259-2261
_RFBING5      2262
_DRNKDY4      2263-2266
_DRNKMO4      2267-2270
_RFDRHV4      2271
_RFDRMN4      2272
_RFDRWM4      2273
_FLSHOT6      2274                    /* Section 11: Calculated Variables */
_PNEUMO2      2275
_RFSEAT2      2276                    /* Section 13: Calculated Variables */
_RFSEAT3      2277
_RFMAM2Y      2278                    /* Section 15: Calculated Variables */
_MAM502Y      2279
_MAM5021      2280
_RFPAP32      2281
_RFPAP33      2282
_RFPSA21      2283                    /* Section 16: Calculated Variables */
_RFBLDS2      2284                    /* Section 17: Calculated Variables */
_RFBLDS3      2285
_RFSIGM2      2286
_COL10YR      2287
_HFOB3YR      2288
_FS5YR        2289
_FOBTFS       2290
_CRCREC       2291
_AIDTST3      2292                    /* Section 18: Calculated Variables */
;

my code below. 

 

 

Grand Advisor
Posts: 17,420

Re: Trouble loading data from the Behavioral Risk Factor Surveillance System

Why are you specifying V7 for the libname for DATAOUT?

Occasional Contributor
Posts: 14

Re: Trouble loading data from the Behavioral Risk Factor Surveillance System

V7 was already on the SAS code that I downloaded directly from the BRFSS website. I will try delete it to see if that works. 

Occasional Contributor
Posts: 14

Re: Trouble loading data from the Behavioral Risk Factor Surveillance System

Still didn't work :/

Grand Advisor
Posts: 17,420

Re: Trouble loading data from the Behavioral Risk Factor Surveillance System

Post your log please.

Grand Advisor
Posts: 10,236

Re: Trouble loading data from the Behavioral Risk Factor Surveillance System

Instead of LIBNAME DATAOUT V7 'F:\Analyzing Health Surveys\SASDATA.sas7bdat' ;

 

try LIBNAME DATAOUT V7 'F:\Analyzing Health Surveys' ;

 

Libraries are locations which allow multiple datasets, putting a dataset name as part of the library except for some other data sources generally is not a going to work.

Ask a Question
Discussion stats
  • 5 replies
  • 365 views
  • 2 likes
  • 3 in conversation