****************************************************************************************************************; ********************************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 "C:\NHANES\MEDICARE_FEASIBILITY_NHANES_1999_2000.dat"; data nhanes.nhanes_99_00_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 1999-2000 Feasibility Data'; proc contents data=nhanes.nhanes_99_00_elig_Medicare varnum; run; proc print data=nhanes.nhanes_99_00_elig_Medicare (obs=10); title2 'Sample Listing - 10 Rows'; run; proc means data=nhanes.nhanes_99_00_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 "C:\NHANES\TEMP\demo.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_99_00_elig_Medicare; run; proc sort data=temp; by SEQN; run; proc sort data=nhanes.demo; by SEQN; run; data nhanes.merg9900_Medicare; merge temp nhanes.demo; by SEQN; /*Regroup race_ethnicity as 4 categories*/ if ridreth1=3 then raceth=1; /*Non-Hispanic White*/ else if ridreth1=4 then raceth=2; /*Non-Hispanic Black*/ else if ridreth1=1 then raceth=3; /*Mexican American*/ else raceth=4; /*Other*/ label raceth = 'Race/ethnicity (recode)'; run; title 'Merged NHANES Feasibility/Demographic Data'; proc contents data=nhanes.merg9900_Medicare varnum; run; proc print data=nhanes.merg9900_Medicare (obs=10); title2 'Sample Listing - 10 Rows of select variables'; var seqn cms_medicare_match riagendr ridreth1 raceth wtmec2yr; run; proc means data=nhanes.merg9900_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 = 'Ineligible'; value GENDER 1 = 'Male' 2 = 'Female'; value RACE_ONE 1 = 'non-Hispanic white' 2 = 'non-Hispanic black' 3 = 'Mexican American' 4 = 'Other'; run; title 'Merged NHANES 1999-2000 Feasibility/Demographic Data'; proc tabulate data=nhanes.merg9900_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; 国产精品久久久久久一级毛片