Changeset 6505 in main


Ignore:
Timestamp:
05/31/14 18:22:05 (8 years ago)
Author:
Paul Leo
Message:

Changes to data prep program, 2011 cdc fruit program, most of changes have to do with changing paths to match with HI, but also have things commented out and/or changed because I don't have HI raceth data yet

Location:
adopters/hi/trunk/src/main/sas/BRFSS
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • adopters/hi/trunk/src/main/sas/BRFSS/FruitVegCDCProg.sas

    r6376 r6505  
    1111
    1212        *-----------------------------------------------------------------------------------;
    13         * Sets path (named "orig") to datasets.                                             ;
    14         * Sets path (named "fruitveg") to write out new dataset.                            ;
    15         *-----------------------------------------------------------------------------------;
    16         libname orig "P:\BRFSS\data\ORIG";
    17         libname fruitveg "P:\BRFSS\data\CDCFruitVeg";
     13        * Sets path (named "orig") to datasets.   ORIGINAL CDC DATASET                      ;
     14        * Sets path (named "fruitveg") to write out new dataset with only SEQNO & any Fruit veg vars.                            ;
     15        *-----------------------------------------------------------------------------------;
     16        libname orig "C:\ibisq\sasData\preliminary\brfss\data\orig";
     17        libname fruitveg "C:\ibisq\sasData\preliminary\brfss\data\orig\CDCFruitVeg";
    1818       
    1919        *-----------------------------------------------------------------------------------;
     
    3333        * "set" command tells SAS the name of the dataset.                                  ;
    3434        *-----------------------------------------------------------------------------------;
    35                 set orig.nm11finl;
     35                set orig.brfss11;
    3636                year=2011;
    3737                run;
     
    7373        * Name the new dataset and output it by including the libname/path for writing out. ;
    7474        *-----------------------------------------------------------------------------------;
    75 DATA fruitveg.brfss11;
     75DATA fruitveg.brfss11_frtvegonly;
    7676SET temp11;
    7777
     78        KEEP SEQNO FSUM VSUM FRLT1 VGLT1 ;
    7879
    7980/*FRUIT AND VEGETABLE DATA*/
     
    194195RUN;
    195196
    196 proc contents DATA=fruitveg.BRFSS11; run;
    197 PROC SORT DATA=fruitveg.BRFSS11;
    198 BY _STSTR _PSU;
    199 RUN;
     197proc contents DATA=fruitveg.brfss11_frtvegonly; run;
    200198
    201199/*
     
    211209
    212210TITLE '2011 MEDIAN FRUIT INTAKE, UNWEIGHTED';
    213 PROC univariate DATA=fruitveg.BRFSS11;
    214 where year=2011;
     211PROC univariate DATA=fruitveg.brfss11_frtvegonly;
    215212var FSUM;
    216213RUN;
    217214
    218215TITLE '2011 MEDIAN VEGETABLE INTAKE, UNWEIGHTED';
    219 PROC univariate DATA=fruitveg.BRFSS11;
    220 where year=2011;
     216PROC univariate DATA=fruitveg.brfss11_frtvegonly;
    221217var VSUM;
    222218RUN;
    223219
    224220TITLE '2011 FRUIT<1/DAY, UNWEIGHTED';
    225 PROC FREQ DATA=fruitveg.BRFSS11;
    226 TABLES FRLT1*YEAR / NOROW NOCOL NOPERCENT;
     221PROC FREQ DATA=fruitveg.brfss11_frtvegonly;
     222TABLES FRLT1 / NOROW NOCOL NOPERCENT;
    227223RUN;
    228224
    229225TITLE '2011 VEGETABLE<1/DAY, UNWEIGHTED';
    230 PROC FREQ DATA=fruitveg.BRFSS11;
    231 TABLES VGLT1*YEAR / NOROW NOCOL NOPERCENT;
    232 RUN;
    233 
    234         data fruitveg.BRFSS11_FRTVEGONLY;
    235                 set fruitveg.BRFSS11;
    236                 KEEP SEQNO FSUM VSUM FRLT1 VGLT1 ;
    237                 run;
     226PROC FREQ DATA=fruitveg.brfss11_frtvegonly;
     227TABLES VGLT1 / NOROW NOCOL NOPERCENT;
     228RUN;
     229/*
     230 Paul Leo - Not needed for HI
    238231        dm "dexport fruitveg.BRFSS11_FRTVEGONLY
    239232        'P:\BRFSS\data\CDCFruitVeg\BRFSS11_FRTVEGONLY.csv' ";
    240 
     233*/
    241234
    242235/*LOIS H. - I'VE NEVER USED THESE PROCS, BELOW, AND THEY DON'T SEEM TO RUN IN MY VERSION OF SAS 9.3. MAYBE THE
  • adopters/hi/trunk/src/main/sas/BRFSS/INCLUDE/FormatBRFSS.sas

    r6393 r6505  
    99        MARITAL 1.0
    1010        LGBT    1.0
    11         GEOCNTY Z3.
     11        GEOCNTY 3.0
    1212        GEOREGION       1.0
    1313        EDU4CAT 1.0
  • adopters/hi/trunk/src/main/sas/BRFSS/INCLUDE/brfss11.sas

    r6393 r6505  
    11******************************************************************************;
    2 * Filename: P:/BRFSS/programs/INCLUDE/brfss11.sas      $$$                    ;
     2* Filename: C:\ibisq\sasData\preliminary\brfss\programs\INCLUDE\brfss11.sas      $$$                    ;
    33* Author: Lois Haggard                                                        ;
    44* 04/24/2014                                                                  ;
     5*                                                                                                                                                         ;
     6* 05/31/2014                                                                                                                              ;
     7* Modified by Paul Leo for Hawaii data location, etc.                                             ;
    58*                                                                             ;
    69* BRFSS data prep program - to be used with the annual NM dataset we get from ;
     
    912******************************************************************************;
    1013
    11         libname orig "P:\BRFSS\data\ORIG\CDC";
    12         libname fruitveg "P:\BRFSS\data\ORIG\CDCFruitVeg";
    13         libname raceth "P:\BRFSS\data\ORIG\RacEthFromWayne";
    14         libname prelim "P:\BRFSS\data";
    15         libname final "Q:\sasData\final";
     14OPTIONS SOURCE2 ;  **SAS code will appear in log ;
     15
     16libname orig "C:\ibisq\sasData\preliminary\brfss\data\orig";
     17        libname fruitveg "C:\ibisq\sasData\preliminary\brfss\data\orig\CDCFruitVeg";
     18        libname raceth "C:\ibisq\sasData\preliminary\brfss\data\orig\Race_Eth";
     19        libname prelim "C:\ibisq\sasData\preliminary\brfss\data";
     20        libname final "C:\ibisq\sasData\final";
    1621       
    17         options nocenter nonumber nodate linesize=112 pagesize=4000 formchar=" " ;
    18 
    19 /*      **** Closes/clears Results Viewer Window (for V9.3 and later) and sets it to reopen for new output. ****;
     22        options nocenter nonumber nodate linesize=122 pagesize=4000 formchar=" " ;
     23
     24        **** Closes/clears Results Viewer Window (for V9.3 and later) and sets it to reopen for new output. ****;
    2025        ods html close ;
    2126        ods html ;
    2227
    23         proc print data=orig.nm11finl (obs=20); var SEQNO _PSU _STSTR _FINALWT ; run;   *$$$;
    24         proc print data=raceth.brfss_2011_raceth (obs=20); var SEQNO DOHRACETH ; run;   *$$$;
     28        proc print data=orig.brfss11 (obs=20); var SEQNO _PSU _STSTR _FINALWT ; run;   *$$$;
     29*       proc print data=raceth.brfss_2011_raceth (obs=20); var SEQNO DOHRACETH ; run;   *$$$;
    2530        proc contents data=fruitveg.brfss11_frtvegonly; run;   *$$$;
    2631        proc print data=fruitveg.brfss11_frtvegonly (obs=20); var SEQNO FSUM VSUM FRLT1 VGLT1; run;   *$$$;
    2732
    28         proc datasets lib=orig nolist;
    29                 modify nm11finl;
     33DATA prelim.brfss11noformat;
     34        set orig.brfss11;
     35        run;
     36
     37        proc datasets lib=prelim nolist;
     38                modify brfss11noformat;
    3039                format _all_; *Remove formats;
    3140                quit;
    32 */
    33 
    34 DATA tmp;    set orig.nm11finl; zipcoden=zipcode+0; drop zipcode; run; *$$$CODE ZIP TO NUMERIC VAR;
    35 
     41
     42
     43DATA tmp;    set prelim.brfss11noformat; zipcoden=zipcode+0; drop zipcode; run; *$$$CODE ZIP TO NUMERIC VAR;
     44
     45/*  Don't have this for Hawaii yet
    3646DATA tmpRACE; set raceth.brfss_2011_raceth; run;         *$$$READ RACE/ETHNICITY VARIABLE INTO MEMORY;
    3747proc sql;
     
    4252   ;
    4353 quit;
    44 
     54*/
    4555
    4656DATA tmpFRTVEG; set fruitveg.brfss11_frtvegonly; run;         *$$$READ _FRTVEG5 VARIABLE INTO MEMORY;
     57/*** ONCE WE HAVE RACEETH - UNCOMMENT THE proc sql above, and this one, and comment the procsql below
    4758proc sql;
    4859   create table tmpBRFS as
     
    5263   ;
    5364 quit;
     65*/
     66 proc sql;
     67   create table tmpBRFS as
     68   select tmp.*, tmpFRTVEG.*
     69   from tmp, tmpFRTVEG
     70   where tmp.seqno=tmpFRTVEG.seqno
     71   ;
     72 quit;
    5473
    5574DATA prelim.BRFSS11;                                    *$$$;
    56                 *********  SET w.d FORMATS FOR NM-IBIS BRFSS VARS  ******;
    57                 %INCLUDE 'P:\BRFSS\programs\INCLUDE\FormatBRFSS.sas'  ;
     75                *********  SET w.d FORMATS FOR IBIS BRFSS VARS  ******;
     76                %INCLUDE 'C:\ibisq\sasData\preliminary\brfss\programs\INCLUDE\FormatBRFSS.sas'  ;
    5877                *********************************************************;
    5978
    6079        set tmpBRFS;
    6180                *********** LIST OF NM-IBIS BRFSS VARS TO KEEP *********;
    62                 %INCLUDE 'P:\BRFSS\programs\INCLUDE\KeepBRFSS.sas'  ;
     81                %INCLUDE 'C:\ibisq\sasData\preliminary\brfss\programs\INCLUDE\KeepBRFSS.sas'  ;
    6382                ********************************************************;
    6483
     
    108127
    109128                GEOCNTY=.;
    110                 if 0<=CTYCODE1<=61 then do;
     129                if 0<=CTYCODE1<=9 then do;
    111130                        GEOCNTY=CTYCODE1;
    112131                end;
    113132
     133/*      Not needed for Hawaii   
    114134                *September 2012 regions;
    115135                GEOREGION=.;
     
    119139                else if CTYCODE1 in (5 9 11 15 25 27 37 41)                     then GEOREGION=4;  *Southeast;
    120140                else if CTYCODE1 in (3 13 17 23 29 35 51 53)            then GEOREGION=5;  *Southwest;
    121 
     141*/
    122142                EDU4CAT=.;
    123143                if 1<=_EDUCAG<=4 then do;
     
    415435
    416436                *YEAR;                          * ;
    417                 *AGE;                   * ;
     437                *AGE;                           * ;
    418438                *SEQNO;                         * ;
    419439                *_PSU;                          * ;
     
    422442
    423443                ZIPCODE = .;            *cdc var not available in 2004;
    424                 if 87000<=ZIPCODEn<=88499 then do;
     444                if 96701<=ZIPCODEn<=96898 then do;
    425445                        ZIPCODE=ZIPCODEn;
    426446                end;
  • adopters/hi/trunk/src/main/sas/BRFSS/INCLUDE/brfss12.sas

    r6407 r6505  
    11******************************************************************************;
    2 * Filename: P:/BRFSS/programs/INCLUDE/brfss12.sas      $$$                    ;
     2* Filename: C:\ibisq\sasData\preliminary\brfss\programs\INCLUDE\brfss12.sas      $$$                    ;
    33* Author: Lois Haggard                                                        ;
    44* 04/24/2014                                                                  ;
     5*                                                                                                                                                         ;
     6* 05/31/2014                                                                                                                              ;
     7* Modified by Paul Leo for Hawaii data location, etc.                                             ;
    58*                                                                             ;
    69* BRFSS data prep program - to be used with the annual NM dataset we get from ;
     
    912******************************************************************************;
    1013
    11         libname orig "P:\BRFSS\data\ORIG\CDC";
    12         libname fruitveg "P:\BRFSS\data\ORIG\CDCFruitVeg";
    13         libname raceth "P:\BRFSS\data\ORIG\RacEthFromWayne";
    14         libname prelim "P:\BRFSS\data";
    15         libname final "Q:\sasData\final";
     14OPTIONS SOURCE2 ;  **SAS code will appear in log ;
     15
     16libname orig "C:\ibisq\sasData\preliminary\brfss\data\orig";
     17        libname fruitveg "C:\ibisq\sasData\preliminary\brfss\data\orig\CDCFruitVeg";
     18        libname raceth "C:\ibisq\sasData\preliminary\brfss\data\orig\Race_Eth";
     19        libname prelim "C:\ibisq\sasData\preliminary\brfss\data";
     20        libname final "C:\ibisq\sasData\final";
    1621       
    1722        options nocenter nonumber nodate linesize=122 pagesize=4000 formchar=" " ;
    1823
    19 /*      **** Closes/clears Results Viewer Window (for V9.3 and later) and sets it to reopen for new output. ****;
     24        **** Closes/clears Results Viewer Window (for V9.3 and later) and sets it to reopen for new output. ****;
    2025        ods html close ;
    2126        ods html ;
    2227
    23         proc print data=orig.nm12finl (obs=20); var SEQNO _PSU _STSTR _FINALWT ; run;   *$$$;
    24         proc print data=raceth.brfss_2012_raceth (obs=20); var SEQNO DOHRACETH ; run;   *$$$;
    25 
    26         proc datasets lib=orig nolist;
    27                 modify nm12finl;
     28        proc print data=orig.brfss12 (obs=20); var SEQNO _PSU _STSTR _FINALWT ; run;   *$$$;
     29*       proc print data=raceth.brfss_2012_raceth (obs=20); var SEQNO DOHRACETH ; run;   *$$$;
     30*       proc contents data=fruitveg.brfss12_frtvegonly; run;   *$$$;
     31*       proc print data=fruitveg.brfss12_frtvegonly (obs=20); var SEQNO FSUM VSUM FRLT1 VGLT1; run;   *$$$;
     32
     33DATA prelim.brfss12noformat;
     34        set orig.brfss12;
     35        run;
     36
     37        proc datasets lib=prelim nolist;
     38                modify brfss12noformat;
    2839                format _all_; *Remove formats;
    2940                quit;
    30 */
    31 
    32 DATA tmp;    set orig.nm12finl; zipcoden=zipcode+0; drop zipcode; run; *$$$CODE ZIP TO NUMERIC VAR;
    33 
     41
     42
     43DATA tmp;    set prelim.brfss12noformat; zipcoden=zipcode+0; drop zipcode; run; *$$$CODE ZIP TO NUMERIC VAR;
     44
     45/*  Don't have this for Hawaii yet
    3446DATA tmpRACE; set raceth.brfss_2012_raceth; run;         *$$$READ RACE/ETHNICITY VARIABLE INTO MEMORY;
    35 
    3647proc sql;
    3748   create table tmpBRFS as
     
    4152   ;
    4253 quit;
     54*/
     55
     56
    4357
    4458DATA prelim.BRFSS12;                                    *$$$;
    45                 *********  SET w.d FORMATS FOR NM-IBIS BRFSS VARS  ******;
    46                         %INCLUDE 'P:\BRFSS\programs\INCLUDE\FormatBRFSS.sas'
    47                         ;
     59                *********  SET w.d FORMATS FOR IBIS BRFSS VARS  ******;
     60                %INCLUDE 'C:\ibisq\sasData\preliminary\brfss\programs\INCLUDE\FormatBRFSS.sas'  ;
    4861                *********************************************************;
    4962
    50         set tmpBRFS;
     63*****   USE THIS ONCE WE HAVE RACETH ABOVE, AND COMMENT OUT SET TMP BELOW ****set tmpBRFS       ******;
     64       
     65        set tmp;
     66
    5167                *********** LIST OF NM-IBIS BRFSS VARS TO KEEP *********;
    52                         %INCLUDE 'P:\BRFSS\programs\INCLUDE\KeepBRFSS.sas' 
    53                         ;
     68                %INCLUDE 'C:\ibisq\sasData\preliminary\brfss\programs\INCLUDE\KeepBRFSS.sas'  ;
    5469                ********************************************************;
    5570
     
    99114
    100115                GEOCNTY=.;
    101                 if 0<=CTYCODE1<=61 then do;
     116                if 0<=CTYCODE1<=9 then do;
    102117                        GEOCNTY=CTYCODE1;
    103118                end;
    104119
     120/*      Not needed for Hawaii   
    105121                *September 2012 regions;
    106122                GEOREGION=.;
     
    110126                else if CTYCODE1 in (5 9 11 15 25 27 37 41)                     then GEOREGION=4;  *Southeast;
    111127                else if CTYCODE1 in (3 13 17 23 29 35 51 53)            then GEOREGION=5;  *Southwest;
    112 
     128*/
    113129                EDU4CAT=.;
    114130                if 1<=_EDUCAG<=4 then do;
     
    405421
    406422                *YEAR;                          * ;
    407                 *AGE;                   * ;
     423                *AGE;                           * ;
    408424                *SEQNO;                         * ;
    409425                *_PSU;                          * ;
     
    412428
    413429                ZIPCODE = .;            *cdc var not available in 2004;
    414                 if 87000<=ZIPCODEn<=88499 then do;
     430                if 96701<=ZIPCODEn<=96898 then do;
    415431                        ZIPCODE=ZIPCODEn;
    416432                end;
  • adopters/hi/trunk/src/main/sas/BRFSS/brfssPrepCDC.sas

    r6407 r6505  
    66* BRFSS data prep program - to be used with the annual NM dataset we get from ;
    77* the CDC.                                                                    ;
     8* 05/31/2014 Modified for HI locations & data by Paul Leo                                         ;
    89*                                                                             ;
     10* orig contains original CDC data sets                                                                            ;
     11* fruitveg is dir that contains the program
    912******************************************************************************;
    1013
    11         libname orig "P:\BRFSS\data\ORIG";
    12         libname fruitveg "P:\BRFSS\data\ORIG\CDCFruitVeg";
    13         libname raceth "P:\BRFSS\data\Race_ethnicity_updates";
    14         libname prelim "P:\BRFSS\data";
    15         libname final "Q:\sasData\final";
     14        libname orig "C:\ibisq\sasData\preliminary\brfss\data\orig";
     15        libname fruitveg "C:\ibisq\sasData\preliminary\brfss\data\orig\CDCFruitVeg";
     16        libname raceth "C:\ibisq\sasData\preliminary\brfss\data\orig\Race_Eth";
     17        libname prelim "C:\ibisq\sasData\preliminary\brfss\data";
     18        libname final "C:\ibisq\sasData\final";
    1619       
    1720        options nocenter nonumber nodate linesize=112 pagesize=4000 formchar=" " ;
     
    2225
    2326                ***********  RUN ANNUAL PROGRAMS  *********************;
     27                ******* NOTE ONLY BRFSS11 & BRFSS12.SAS HAVE LIBNAMES AND OTHER CHANGES;
    2428                ****** THESE OUTPUT ANNUAL DATASETS IN PRELIM LIB *****;
    25                 %INCLUDE 'P:\BRFSS\programs\INCLUDE\brfss04.sas'  ;
    26                 %INCLUDE 'P:\BRFSS\programs\INCLUDE\brfss05.sas'  ;
    27                 %INCLUDE 'P:\BRFSS\programs\INCLUDE\brfss06.sas'  ;
    28                 %INCLUDE 'P:\BRFSS\programs\INCLUDE\brfss07.sas'  ;
    29                 %INCLUDE 'P:\BRFSS\programs\INCLUDE\brfss08.sas'  ;
    30                 %INCLUDE 'P:\BRFSS\programs\INCLUDE\brfss09.sas'  ;
    31                 %INCLUDE 'P:\BRFSS\programs\INCLUDE\brfss10.sas'  ;
    32                 %INCLUDE 'P:\BRFSS\programs\INCLUDE\brfss11.sas'  ;
    33                 %INCLUDE 'P:\BRFSS\programs\INCLUDE\brfss12.sas'  ;
     29*               %INCLUDE 'C:\ibisq\sasData\preliminary\brfss\programs\INCLUDE\brfss04.sas'  ;
     30*               %INCLUDE 'C:\ibisq\sasData\preliminary\brfss\programs\INCLUDE\brfss05.sas'  ;
     31*               %INCLUDE 'C:\ibisq\sasData\preliminary\brfss\programs\INCLUDE\brfss06.sas'  ;
     32*               %INCLUDE 'C:\ibisq\sasData\preliminary\brfss\programs\INCLUDE\brfss07.sas'  ;
     33*               %INCLUDE 'C:\ibisq\sasData\preliminary\brfss\programs\INCLUDE\brfss08.sas'  ;
     34*               %INCLUDE 'C:\ibisq\sasData\preliminary\brfss\programs\INCLUDE\brfss09.sas'  ;
     35*               %INCLUDE 'C:\ibisq\sasData\preliminary\brfss\programs\INCLUDE\brfss10.sas'  ;
     36                %INCLUDE 'C:\ibisq\sasData\preliminary\brfss\programs\INCLUDE\brfss11.sas'  ;
     37                %INCLUDE 'C:\ibisq\sasData\preliminary\brfss\programs\INCLUDE\brfss12.sas'  ;
    3438                ********************************************************;
    3539
     40        **** Concatenate DataSets *********;
     41       
    3642        data prelim.brfss04_12x;
    3743
     44/*     
    3845                set prelim.brfss04
    3946                        prelim.brfss05
     
    4350                        prelim.brfss09
    4451                        prelim.brfss10
    45                         prelim.brfss11
     52*/                     
     53                set     prelim.brfss11
     54
    4655                        prelim.brfss12
    4756                        ;
    4857
    4958                ***********  LABEL NM-IBIS BRFSS VARS  *****************;
    50                 %INCLUDE 'P:\BRFSS\programs\INCLUDE\LabelBRFSS.sas'  ;
     59                ***********  This is where we would add Labels for HI ***;
     60                %INCLUDE 'C:\ibisq\sasData\preliminary\brfss\programs\INCLUDE\LabelBRFSS.sas'  ;
    5161                ********************************************************;
    5262
     
    8595                run;
    8696
    87         title 'year=2004'; proc print data=brfs (obs=15); where year=2004; var SEQNO _PSU _STSTR _FINALWT ZIPCODE; run;
     97/*      title 'year=2004'; proc print data=brfs (obs=15); where year=2004; var SEQNO _PSU _STSTR _FINALWT ZIPCODE; run;
    8898        title 'year=2005'; proc print data=brfs (obs=15); where year=2005; var SEQNO _PSU _STSTR _FINALWT ZIPCODE; run;
    8999        title 'year=2006'; proc print data=brfs (obs=15); where year=2006; var SEQNO _PSU _STSTR _FINALWT ZIPCODE; run;
     
    92102        title 'year=2009'; proc print data=brfs (obs=15); where year=2009; var SEQNO _PSU _STSTR _FINALWT ZIPCODE; run;
    93103        title 'year=2010'; proc print data=brfs (obs=15); where year=2010; var SEQNO _PSU _STSTR _FINALWT ZIPCODE; run;
     104*/
    94105        title 'year=2011'; proc print data=brfs (obs=15); where year=2011; var SEQNO _PSU _STSTR _FINALWT ZIPCODE; run;
     106
    95107        title 'year=2012'; proc print data=brfs (obs=15); where year=2012; var SEQNO _PSU _STSTR _FINALWT ZIPCODE; run;
    96108
Note: See TracChangeset for help on using the changeset viewer.