-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathE3.sas
132 lines (100 loc) · 3.52 KB
/
E3.sas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/****************************************************************\
PROGRAM: C:\MEPS\PROG\EXAMPLE_E3.SAS
DESCRIPTION: THIS EXAMPLE SHOWS HOW TO CREATE A LONGITUDINAL
FILE FOR 1999-2000 (PANEL 4) AND COMPUTE PERSON-
LEVEL ESTIMATES FOR INSURANCE COVERAGE AND
EXPENDITURES.
VARIABLES: UNINS99, UNINS00
(INSURED ALL OF 1999, 2000)
TOTEXP99, TOTEXP00
(TOTAL HEALTHCARE EXPENDITURES, 1999)
INPUT FILE: (1) C:\MEPS\DATA\H50.SAS7BDAT (2000 FULL-YEAR DATA FILE)
(3) C:\MEPS\DATA\H38.SAS7BDAT (1999 FULL-YEAR DATA FILE)
(5) C:\MEPS\DATA\H58.SAS7BDAT
(PANEL 4 LONGITUDINAL WEIGHT FILE)
\****************************************************************/
LIBNAME CMEPS V8 'C:\MEPS\DATA';
FOOTNOTE 'PROGRAM: C:\MEPS\PROG\EXAMPLE_E3.SAS';
TITLE1 'AHRQ MEPS DATA USERS WORKSHOP (ESTIMATION) -- NOV/DEC 2004';
TITLE2 'PANEL 4 LONGITUDINAL FILE (1999 - 2000)';
TITLE3 ' ';
/***** THESE DATA STEPS READ IN THE REQUIRED VARIABLES FROM THE *****/
/***** FULL-YEAR FILES. *****/
/***** USE THE PANELyy VARIABLE TO PICK OUT PANEL 4 PERSONS *****/
/***** 1999 DATA *****/
DATA H38;
SET CMEPS.H38 (KEEP= DUPERSID UNINS99 TOTEXP99 PANEL99);
WHERE PANEL99 = 4;
DROP PANEL99;
RUN;
/***** 2000 DATA *****/
DATA H50;
SET CMEPS.H50 (KEEP= DUPERSID UNINS00 TOTEXP00 PANEL00);
WHERE PANEL00 = 4;
DROP PANEL00;
RUN;
PROC SORT DATA= H38;
BY DUPERSID;
RUN;
PROC SORT DATA= H50;
BY DUPERSID;
RUN;
/***** GET REQUIRED VARIABLES FROM THE PANEL 4 LONGITUDINAL *****/
/***** FILE. *****/
/***** THE 'WHERE YRINDP4 = 1' LINE SELECTS PERSONS IN BOTH *****/
/***** THE 1999 AND 2000 FILES. *****/
DATA H58;
SET CMEPS.H58 (KEEP= DUPERSID LONGWTP4 VARPSUP4 VARSTRP4
YRINDP4);
WHERE YRINDP4 = 1;
DROP YRINDP4;
RUN;
PROC SORT DATA= H58;
BY DUPERSID;
RUN;
/***** 1999 ANALYTIC VARIABLES ARE RE-CODED 1 OR 0. *****/
/***** THE 2000 VARIABLES ARE RE-CODED TO 100 OR 0 IN ORDER TO *****/
/***** HAVE THE PROC SURVEYMEANS 'MEAN' READ AS A PERCENT. *****/
/***** THE '2' [NO] VALUES FOR UNINS99 AND UNINS00 ARE RE-CODED *****/
/***** TO 0. *****/
DATA LONGP4;
MERGE H38 (IN= A) H50 (IN= B) H58 (IN= C);
BY DUPERSID;
IF A AND B AND C;
IF UNINS99 = 1 THEN UNINS99 = 1;
ELSE UNINS99 = 0;
IF UNINS00 = 1 THEN UNINS00 = 100;
ELSE UNINS00 = 0;
IF TOTEXP99 > 0 THEN TOTEXP99 = 1;
ELSE TOTEXP99 = 0;
IF TOTEXP00 > 0 THEN TOTEXP00 = 100;
ELSE TOTEXP00 = 0;
RUN;
TITLE4 'OF THOSE WITH SOME EXPENSE IN 1999';
PROC FREQ DATA= LONGP4;
TABLES TOTEXP00 / LIST MISSING;
WHERE TOTEXP99 = 1;
WEIGHT LONGWTP4;
RUN;
TITLE4 'OF THOSE WITH NO EXPENSE IN 1999';
PROC FREQ DATA= LONGP4;
TABLES TOTEXP00 / LIST MISSING;
WHERE TOTEXP99 = 0;
WEIGHT LONGWTP4;
RUN;
TITLE4 'INSURANCE STATUS';
PROC SURVEYMEANS DATA= LONGP4 NOBS SUMWGT MEAN STDERR CLM;
VAR UNINS00 ;
DOMAIN UNINS99;
STRATA VARSTRP4;
CLUSTER VARPSUP4;
WEIGHT LONGWTP4; ;
RUN;
TITLE4 'HEALTHCARE EXPENDITURES';
PROC SURVEYMEANS DATA= LONGP4 NOBS SUMWGT MEAN STDERR CLM;
VAR TOTEXP00 ;
DOMAIN TOTEXP99;
STRATA VARSTRP4;
CLUSTER VARPSUP4;
WEIGHT LONGWTP4; ;
RUN;