/*****************************************************************/ * Converting 1999-2004 NHANES demographic and * * body measures SAS transport files into SAS datasets * * * /****************************************************************/; %macro transport (transfile); libname xp xport "C:\NHANES\&transfile..xpt"; proc copy in=xp out=work; run; proc sort data=&transfile; by seqn; run; %mend transport; %transport (demo); %transport (demo_b); %transport (demo_c); %transport (bmx); %transport (bmx_b); %transport (bmx_c); data demoall; set demo demo_b demo_c; run; data bmxall; set bmx bmx_b bmx_c; run; /*******************************************************************/ * Filename statement specifies local location to which * * NHANES Feasibility .DAT data set was copied * * libname statements specifies local location of permanent * * SAS data set to be created * /*******************************************************************/; * Log/List Options *; options ls=120 ps=42 missing=' ' nocenter validvarname=upcase compress=binary; * Output SAS Library *; libname NHANES 'C:\NHANES'; * <-- Place Output Library Path Here *; * Input File Reference *; filename intext1 "C:\NHANES\MEDICARE_FEASIBILITY_NHANES_1999_2000.dat"; data nhanes_99_00_elig_Medicare; infile intext1 lrecl=142 ; attrib SEQN length=5 format=Z5. label='NCHS Survey Identifier - Sample Sequence Number' CMS_MEDICARE_MATCH length=3 format=1. label='CMS MEDICARE MATCH STATUS' on_denom_2005 length=3 format=1. label='ON DENOMINATOR FILE INDICATOR (2005)' on_carrier_2005 length=3 format=1. label='ON CARRIER FILE INDICATOR (2005)'; input @ 1 SEQN 5. @ 15 CMS_MEDICARE_MATCH 1. @ 31 on_DENOM_2005 1. @ 65 on_CARRIER_2005 1. ; run; * Input File Reference *; filename intext2 "C:\NHANES\MEDICARE_FEASIBILITY_NHANES_2001_2002.dat"; data nhanes_01_02_elig_Medicare; infile intext2 lrecl=142 ; attrib SEQN length=5 format=Z5. label='NCHS Survey Identifier - Sample Sequence Number' CMS_MEDICARE_MATCH length=3 format=1. label='CMS MEDICARE MATCH STATUS' on_denom_2005 length=3 format=1. label='ON DENOMINATOR FILE INDICATOR (2005)' on_carrier_2005 length=3 format=1. label='ON CARRIER FILE INDICATOR (2005)'; input @ 1 SEQN 5. @ 15 CMS_MEDICARE_MATCH 1. @ 31 on_DENOM_2005 1. @ 65 on_CARRIER_2005 1. ; run; * Input File Reference *; filename intext3 "C:\NHANES\MEDICARE_FEASIBILITY_NHANES_2003_2004.dat"; data nhanes_03_04_elig_Medicare; infile intext3 lrecl=142 ; attrib SEQN length=5 format=Z5. label='NCHS Survey Identifier - Sample Sequence Number' CMS_MEDICARE_MATCH length=3 format=1. label='CMS MEDICARE MATCH STATUS' on_denom_2005 length=3 format=1. label='ON DENOMINATOR FILE INDICATOR (2005)' on_carrier_2005 length=3 format=1. label='ON CARRIER FILE INDICATOR (2005)'; input @ 1 SEQN 5. @ 15 CMS_MEDICARE_MATCH 1. @ 31 on_DENOM_2005 1. @ 65 on_CARRIER_2005 1. ; run; *Append feasibility files together; data feasall; set nhanes_99_00_elig_Medicare nhanes_01_02_elig_Medicare nhanes_03_04_elig_Medicare; run; proc sort data=demoall; by seqn; proc sort data=bmxall; by seqn; proc sort data=feasall; by seqn; run; *Merge feasibility file with NHANES demographic and body measures files; data feasdemo; merge demoall (in=a) bmxall (in=b) feasall (in=c); by seqn; if a; run; *Create temporary formats of variables to be examined; proc format; value racef 0='Overall' 1='non-Hispanic black' 2='Mexican American' 3='non-Hispanic white and others'; value CMSMATCH 1 = 'Linked' 2 = 'Not Linked' 3 = 'Ineligible'; value ON_FILE 1='Yes' 0='No'; value ynfmt 1='Yes' 0='No'; value OBESE_ 1='Obese' 0='Not Obese'; value sexfmt 1='Male' 2='Female'; run; /********************************************************************/ * * * Until specific recommendations are available, preliminary * * guidance is for you to create adjusted survey weights that account * * for linkage-ineligibility and non-matches. Please see Course 4, * * Module 11 (Non-Response and Weighting Issues with the NHANES-CMS * * Linked Data) for more information. The examples below include * * a weight variable wt_linkage_adj, which represents the adjusted * * survey weight. * * * /********************************************************************/; data ds1; set feasdemo; *create obesity indicator; If BMXBMI>=30 then obese=1; Else if 0=65; format CMS_MEDICARE_MATCH cmsmatch. ON_CARRIER_2005 on_file. OBESE obese_.; Title "Merged NHANES Feasibility Data Frequency Distribution of obesity by Medicare Match Status"; run; ******degrees of freedom using the study population defined in course 3 module 10 task 2; proc sort data=ds1; by sdmvstra sdmvpsu; run; proc descript data=ds1 design=WR DEFT2 ATLEVEL1=1 ATLEVEL2=2 ; nest sdmvstra sdmvpsu; Weight wt_linkage_adj; SUBPOPN ridageyr>=65 and cms_medicare_match=1 and obese=1; Var carrier05; class racecat; Tables racecat; Output atlev1=numstrat atlev2=numpsu mean=mean semean=semean NSUM=N / filetype=SAS filename=test1 replace; Rtitle "Percent with records on the 2005 carrier file, aged 65 and older that were obese by race and Hispanic origin"; run; Proc sort data=test1; by racecat; run; DATA test2; SET test1; percent=round(mean,.01); sepercent=round(semean,.01); df=atlev2-atlev1; tlow=tinv(.025,df); tup=tinv(.975,df); rse=round((semean/mean)*100,.01); rsese=round((1/sqrt(df)),.01); ll=round((mean+tlow*semean),.01); ul=round((mean+tup*semean),.01); run; proc print data=test2 noobs; VAR Racecat nsum Percent Sepercent df tup ll ul; title1 'Degrees of Freedom and Wald 95% Confidence Interval'; title2 Percent Linked to 2005 Carrier file by Race and Hispanic Origin? title2 'Percent Obese that Linked to 2005 Carrier file by Race and Hispanic Origin'; title3 'for those who were age 65+ and obese: NHANES 1999-2004'; format racecat racef.; run; ************* t-test; proc sort data=ds1; by sdmvstra sdmvpsu; run; proc descript data=ds1 design=wr; nest sdmvstra sdmvpsu; Weight wt_linkage_adj; subpopn ridageyr >= 65 and cms_medicare_match=1 and on_carrier_2005=1; class obese/NoFREQ; var ridageyr; print nsum mean semean/style=nchs; rformat obese obese_.; rtitle "Mean age for those who were obese and on the 2005 carrier file for ages 65+: NHANES 1999-2004 linked to Medicare 1999-2007"; run; *ttest; proc sort data=ds1; by sdmvstra sdmvpsu; run; proc descript data=ds1 design=wr; nest sdmvstra sdmvpsu; Weight wt_linkage_adj; subpopn ridageyr >= 65 and cms_medicare_match=1 and on_carrier_2005=1; class obese/NoFREQ; var ridageyr; contrast obese = (1 -1)/name = "obese vs. not"; print nsum t_mean p_mean/style=nchs; rformat obese obese_.; rtitle "Significance test for difference between mean age for those who were obese vs. not obese"; rtitle2 "NHANES 1999-2004 linked to Medicare"; run; ******** Chi-square ********; proc sort data=ds1; by sdmvstra sdmvpsu; run; proc crosstab data=ds1 design=wr; nest sdmvstra sdmvpsu; Weight wt_linkage_id; subpopn ridageyr >= 65 and cms_medicare_match=1 and on_carrier_2005=1; class riagendr obese/NoFreq; table riagendr*obese; print nsum rowper serow colper/tests=all; rformat riagendr sexfmt.; rformat obese obese_.; rtitle "Chi-square test for gender by obesity status and on the 2005 Carrier File: NHANES 1999-2004 linked to Medicare 1999-2007"; run; 国产精品久久久久久一级毛片