****************************************************************************************************************; ********************************Course 2 SAS Program - Medicare************************************************; ****************************************************************************************************************; ***************************************************************************************; *Course 2, Module 6, Task 1 - Create SAS formatted Feasibility File; ***************************************************************************************; /*******************************************************************/ * 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 intext "\\...\MCARE_FEAS_NHANES_2011_2012.DAT"; data nhanes.nhanes_11_12_elig_Medicare; infile intext lrecl=142 ; * Lengths *; input @ 1 SEQN 5. @ 15 CMS_MEDICARE_MATCH 1. ; * Labels *; label SEQN = 'NHANES SEQN' CMS_MEDICARE_MATCH = 'CMS Medicare Match Status' ; * Keep *; keep SEQN CMS_MEDICARE_MATCH ; run; title 'NHANES 2011-2012 Feasibility Data'; proc contents data=nhanes.nhanes_11_12_elig_Medicare varnum; run; proc print data=nhanes.nhanes_11_12_elig_Medicare (obs=10); title2 'Sample Listing - 10 Rows'; run; proc means data=nhanes.nhanes_11_12_elig_Medicare; title2 'Simple Means'; run; ***************************************************************************************; *Course 2, Module 6, Task 2 - Extract and Copy NHANES Data Files to Permanent Libraries; ***************************************************************************************; * This program will output data to the SAS library created in Task 1: libname NHANES "C:\NHANES\"; libname XP xport "\\...\demo_g.xpt"; proc copy in=XP out=NHANES; run; ***************************************************************************************; *Course 2, Module 7, Task 1 - Merge Datasets; ***************************************************************************************; * This program will output the merged data to the SAS library created in Task 1: libname NHANES "C:\NHANES\"; data temp; set nhanes.nhanes_11_12_elig_Medicare; run; proc sort data=temp; by SEQN; run; proc sort data=nhanes.demo_g; by SEQN; run; data nhanes.merg1112_Medicare; merge temp nhanes.demo_g; by SEQN; /*Regroup race_ethnicity as 4 categories*/ if ridreth3=3 then raceth=1; /*Non-Hispanic White*/ else if ridreth3=4 then raceth=2; /*Non-Hispanic Black*/ else if ridreth3 in (1,2) then raceth=3; /*Mexican American/Other Hispanic*/ else raceth=4; /*Other*/ label raceth = 'Race/ethnicity (recode)'; run; title 'Merged NHANES Feasibility/Demographic Data'; proc contents data=nhanes.merg1112_Medicare varnum; run; proc print data=nhanes.merg1112_Medicare (obs=10); title2 'Sample Listing - 10 Rows of select variables'; var seqn cms_medicare_match riagendr ridreth3 raceth wtmec2yr; run; proc means data=nhanes.merg1112_Medicare; title2 'Simple Means'; var seqn cms_medicare_match; run; ***************************************************************************************; *Course 2, Module 8, Task 1 - Produce Table of Race/Ethnicity and Gender by Linkage Eligibility and Match Status of NHANES Respondents; ***************************************************************************************; * This program will read data from the SAS library created in Task 1: libname NHANES "C:\NHANES\"; proc format; value CMSMATCH 1 = 'Linked' 2 = 'Not Linked' 3 = 'Linked - Child' 9 = 'Ineligible'; value GENDER 1 = 'Male' 2 = 'Female'; value RACE_ONE 1 = 'non-Hispanic white' 2 = 'non-Hispanic black' 3 = 'Mexican American/Other Hispanic' 4 = 'Other'; run; title 'Merged NHANES 2011-2012 Feasibility/Demographic Data'; proc tabulate data=nhanes.merg1112_Medicare format=BEST10.0; class RACETH / order=unformatted missing; class RIAGENDR / order=unformatted missing; class CMS_MEDICARE_MATCH / order=formatted missing; table N="Total" (RIAGENDR RACETH)*N=' ' , /* Row Dimensions */ CMS_MEDICARE_MATCH=' ' /* Column Dimension */ /ROW=FLOAT; format CMS_MEDICARE_MATCH cmsmatch. RIAGENDR gender. RACETH race_one.; title2 'Frequency Distribution of Gender and Race/ethnicity by Medicare Match Status'; run; 国产精品久久久久久一级毛片