****************************************************************************************************************; ********************************Course 2 SAS Programs - Medicaid************************************************; ****************************************************************************************************************; ***************************************************************************************; *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\MEDICAID_FEASIBILITY_NHANES_1999_2000.dat"; data nhanes.nhanes_99_00_elig_Medicaid; infile intext lrecl=60 ; input @ 1 SEQN 5. @15 CMS_MEDICAID_MATCH 1. ; * Labels *; label SEQN = 'NHANES SEQN' CMS_MEDICAID_MATCH = 'CMS Medicaid Match Status' ; * Keep *; keep SEQN CMS_MEDICAID_MATCH ; run; title 'NHANES 1999-2000 Feasibility Data'; proc contents data=nhanes.nhanes_99_00_elig_Medicaid varnum; run; proc print data=nhanes.nhanes_99_00_elig_Medicaid (obs=10); title2 'Sample Listing - 10 Rows'; run; proc means data=nhanes.nhanes_99_00_elig_Medicaid; 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_Medicaid; run; proc sort data=temp; by SEQN; run; proc sort data=nhanes.demo; by SEQN; run; data nhanes.merg9900_Medicaid; 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_Medicaid varnum; run; proc print data=nhanes.merg9900_Medicaid (obs=10); title2 'Sample Listing - 10 Rows of select variables'; var seqn cms_medicaid_match riagendr ridreth1 raceth wtmec2yr; run; proc means data=nhanes.merg9900_Medicaid; title2 'Simple Means'; var seqn CMS_MEDICAID_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_Medicaid format=BEST10.0; class RACETH / order=unformatted missing; class RIAGENDR / order=unformatted missing; class CMS_MEDICAID_MATCH / order=formatted missing; table N="Total" (RIAGENDR RACETH)*N=' ' , /* Row Dimensions */ CMS_MEDICAID_MATCH=' ' /* Column Dimension */ /ROW=FLOAT; format CMS_MEDICAID_MATCH cmsmatch. RIAGENDR gender. RACETH race_one.; title2 'Frequency Distribution of Gender and Race/ethnicity by Medicaid Match Status'; run; 国产精品久久久久久一级毛片