1                                        The SAS System          13:11 Sunday, November 21, 2004

 

NOTE: Copyright (c) 1999-2001 by SAS Institute Inc., Cary, NC, USA.

NOTE: SAS (r) Proprietary Software Release 8.2 (TS2M0)

      Licensed to AGENCY FOR HEALTHCARE RESEARCH & QUALITY, Site 0040776001.

NOTE: This session is executing on the WIN_PRO  platform.

 

 

 

1          options ls=120 ps=79 nodate;

2          ods noproctitle;

3          /************************************************************************************\

4          Program:      c:\meps\prog\Example_L3.sas

5         

6          Description:  This example shows how to:

7                        (1) Aggregate event records to the person level

8                        (2) Make 1 annual variable from 3 round variables

9                        (3) Make a categorical variable from a continuous variable

10                       (4) Use SUDAAN to calculate standard errors

11        

12         Input Files:  c:\meps\data\h59g.sas7bdat (2001 Office-Based Visits)

13                       c:\meps\data\h60.sas7bdat (2001 Full-Year File)

14         \************************************************************************************/

15        

16         libname hc 'c:\meps\data';

 

NOTE: Libref HC was successfully assigned as follows:

      Engine:        V8

      Physical Name: c:\meps\data

17        

18         title 'AHRQ MEPS DATA USERS WORKSHOP (LINKING) -- NOV/DEC 2004';

19         title2 'Link 2001 Household File and 2001 Events File';

20         

21         proc format;

22           value inscov  1='1 Any Private'  2='2 Public Only'  3='3 Uninsured';

NOTE: Format INSCOV has been output.

23           value insured  1='1 Insured'  2='2 Uninsured';

NOTE: Format INSURED has been output.

24           value agecat

25             1='1. 0-3'

26             2='2. 4-7'

27             3='3. 8-11'

28             4='4. 12-15'

29             5='5. 16-17'

30             6='6. 18+';

NOTE: Format AGECAT has been output.

31           value genckup  1='1 General Checkup'  2='2 No General Checkup';

NOTE: Format GENCKUP has been output.

32         run;

 

 

33        

34                  /* 2001 Office-based medical provider visits                                 */

35                  /* Identify persons with a visit for a general check-up & their expenditures */

36        

37         title3 "# Persons with a General Checkup in a Provider's Office";

38         data h59g;   set hc.h59g(keep=dupersid vstctgry obxp01x obsf01x);   by dupersid;

39           if first.dupersid then do;

40             genckup=.;

41             ambtotpd=0;

42             ambfampd=0;

43           end;

44           retain genckup ambtotpd ambfampd;

45           if vstctgry = 1 then do;

46              genckup = 1;

47              ambtotpd + obxp01x;

48              ambfampd + obsf01x;

49           end;

50           if last.dupersid;

51           label

52             genckup ='Had Office-Based General Checkup'

53             ambtotpd='Total Amount Paid'

54             ambfampd='Amount Paid by Family';

55           keep  dupersid genckup ambtotpd ambfampd;

56         run;

 

NOTE: There were 147490 observations read from the data set HC.H59G.

NOTE: The data set WORK.H59G has 23286 observations and 4 variables.

 

57         proc freq;   tables genckup/missing;   run;


 

2                                                    The SAS System

 

 

NOTE: There were 23286 observations read from the data set WORK.H59G.

NOTE: The PROCEDURE FREQ printed page 1.

 

58        

59         title3 'Variables from Full-Year File (Persons w/ Positive Weight)';

60         data h60;  set hc.h60(keep=dupersid perwt01f varstr01 varpsu01 age31x--age53x inscov01);

61           by dupersid;

62                  /* subset to positive weight persons */

63           if perwt01f > 0;

64                  /* define AGE as last nonmissing age in 2001 */

65           if age53x ge 0 then age=age53x;

66             else if age42x ge 0 then age=age42x;

67             else if age31x ge 0 then age=age31x;

68                  /* make age category variable */

69           agecat = (age ge 0) + (age gt 3) + (age gt 7) + (age gt 11) + (age gt 15) + (age gt 17);

70                  /* make insurance status variable */

71           if inscov01>2 then insured=2;   else insured=1;

72           label insured='Had Health Insurance in 2001';

73         run;

 

NOTE: There were 33556 observations read from the data set HC.H60.

NOTE: The data set WORK.H60 has 32122 observations and 11 variables.

 

74         proc freq;   tables

75           insured*inscov01

76           agecat/list missing;

77           format  insured insured.  inscov01 inscov.  agecat agecat.;

78         run;

 

NOTE: There were 32122 observations read from the data set WORK.H60.

NOTE: The PROCEDURE FREQ printed page 2.

 

79         proc means nmiss min max maxdec=0;   class agecat;   var age;   format agecat agecat.;   run;

 

NOTE: There were 32122 observations read from the data set WORK.H60.

 

NOTE: The PROCEDURE MEANS printed page 3.

 

80        

81         title3 'Link Person-Level File from Events File with Full-Year Person File';

82         data pers;   merge

83           h59g

84           h60(drop=age31x--age53x inscov01 in=a);   by dupersid;   if a;

85           if genckup = . then genckup=2;

86         run;

 

NOTE: There were 23286 observations read from the data set WORK.H59G.

NOTE: There were 32122 observations read from the data set WORK.H60.

NOTE: The data set WORK.PERS has 32122 observations and 10 variables.

 

87         proc freq;   tables genckup;   format genckup genckup.;   run;

 

NOTE: There were 32122 observations read from the data set WORK.PERS.

NOTE: The PROCEDURE FREQ printed page 4.

 

88        

89                  /* sort for SUDAAN */

90         proc sort;   by varstr01 varpsu01;   run;

 

NOTE: There were 32122 observations read from the data set WORK.PERS.

NOTE: The data set WORK.PERS has 32122 observations and 10 variables.

 

91        

92         title3 'Persons Age 18+';

93         proc crosstab data=pers filetype=sas design=wr notot norow;

94           subpopn  agecat=6;

95           nest  varstr01 varpsu01/missunit;

96           weight  perwt01f;

97           subgroup  genckup insured;

98           levels  2 2;

99           tables  genckup genckup*insured;

100          print  nsum colper secol / style=box wsumfmt=f15.0 nodate notime;

101          rformat  genckup genckup.;

102          rformat  insured insured.;

103        run;

 

 


 

3                                                    The SAS System

 

 

*************************************************************************

This copy of SAS-Callable Single-User SUDAAN, serial number A0000039, for Windows is licensed to Social & Scientific

Systems (The Sudaan Administrator). It expires on November 04, 2004.

 

*************************************************************************

 

 

 

 

WARNING:

Your annual SUDAAN license has expired.  SUDAAN will no longer execute after January 31, 2005.  Please contact the

SUDAAN representative at your site to have your license renewed.  You may also call the SUDAAN Product Coordinator at

919-541-6602 or send e-mail toSUDAAN@RTI.ORG for further assistance.

 

 

Opened SAS data file PERS for reading.

 

 

NOTE: There were 32122 observations read from the data set WORK.PERS.

NOTE: The PROCEDURE CROSSTAB printed pages 5-7.

 

104       

105        title3 'Persons Age 18+ with a General Checkup';

106        proc means data=pers(where=(agecat=6 & genckup=1)) n mean maxdec=2;

107          class  insured;

108          format  insured insured.;

109          var  ambtotpd ambfampd;

110          weight perwt01f;

111        run;

 

NOTE: There were 9369 observations read from the data set WORK.PERS.

      WHERE (agecat=6) and (genckup=1);

NOTE: The PROCEDURE MEANS printed page 8.

 

NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414


 

                                AHRQ MEPS DATA USERS WORKSHOP (LINKING) -- NOV/DEC 2004                                1

                                     Link 2001 Household File and 2001 Events File

                                # Persons with a General Checkup in a Provider's Office

 

                                            Had Office-Based General Checkup

 

                                                                  Cumulative    Cumulative

                              genckup    Frequency     Percent     Frequency      Percent

                              ------------------------------------------------------------

                                    .       10859       46.63         10859        46.63 

                                    1       12427       53.37         23286       100.00 


 

                                AHRQ MEPS DATA USERS WORKSHOP (LINKING) -- NOV/DEC 2004                                2

                                     Link 2001 Household File and 2001 Events File

                               Variables from Full-Year File (Persons w/ Positive Weight)

 

                                                                            Cumulative    Cumulative

                       insured         INSCOV01    Frequency     Percent     Frequency      Percent

                   ---------------------------------------------------------------------------------

                   1 Insured      1 Any Private       21127       65.77         21127        65.77 

                   1 Insured      2 Public Only        6410       19.96         27537        85.73 

                   2 Uninsured    3 Uninsured          4585       14.27         32122       100.00 

 

 

                                                                  Cumulative    Cumulative

                               agecat    Frequency     Percent     Frequency      Percent

                             -------------------------------------------------------------

                             1. 0-3          1847        5.75          1847         5.75 

                             2. 4-7          2096        6.53          3943        12.28 

                             3. 8-11         2122        6.61          6065        18.88 

                             4. 12-15        2103        6.55          8168        25.43 

                             5. 16-17         989        3.08          9157        28.51 

                             6. 18+         22965       71.49         32122       100.00 


 

                                AHRQ MEPS DATA USERS WORKSHOP (LINKING) -- NOV/DEC 2004                                3

                                     Link 2001 Household File and 2001 Events File

                               Variables from Full-Year File (Persons w/ Positive Weight)

 

                                                Analysis Variable : age

 

                                                        N

                               agecat      N Obs     Miss         Minimum         Maximum

                               ----------------------------------------------------------

                               1. 0-3       1847        0               0               3

 

                               2. 4-7       2096        0               4               7

 

                               3. 8-11      2122        0               8              11

 

                               4. 12-15     2103        0              12              15

 

                               5. 16-17      989        0              16              17

 

                               6. 18+      22965        0              18              85

                               ----------------------------------------------------------


 

                                AHRQ MEPS DATA USERS WORKSHOP (LINKING) -- NOV/DEC 2004                                4

                                     Link 2001 Household File and 2001 Events File

                           Link Person-Level File from Events File with Full-Year Person File

 

                                            Had Office-Based General Checkup

 

                                                                        Cumulative    Cumulative

                                    genckup    Frequency     Percent     Frequency      Percent

                       -------------------------------------------------------------------------

                       1 General Checkup          12161       37.86         12161        37.86 

                       2 No General Checkup       19961       62.14         32122       100.00 


 

                                AHRQ MEPS DATA USERS WORKSHOP (LINKING) -- NOV/DEC 2004                                5

                                     Link 2001 Household File and 2001 Events File

                                                    Persons Age 18+

 

 

 

                                  S U D A A N

            Software for the Statistical Analysis of Correlated Data

           Copyright      Research Triangle Institute      January 2002

                                 Release 8.0.1

 

 

Number of observations read    :  32122    Weighted count :284247327

Observations in subpopulation  :  22965    Weighted count:211917458

Denominator degrees of freedom :    412


 

                                                                                                                       

                                                                                                                      

                                                                                                                       

                                               Research Triangle Institute                                  Page  : 1 

                                                 The CROSSTAB Procedure                                     Table : 1 

                                                                                                                      

Variance Estimation Method: Taylor Series (WR)                                                                         

For Subpopulation: AGECAT = 6                                                                                         

by: Had Office-Based General Checkup.                                                                                  

                                                                                                                      

-----------------------------------------------------------------------                                               

|                 |                  |                                                                                

|                 |                  | Had Office-Based General                                                       

|                 |                  | Checkup                                                                        

|                 |                  | Total    | 1        | 2 No     |                                               

|                 |                  |          | General  | General  |                                               

|                 |                  |          | Checkup  | Checkup  |                                               

-----------------------------------------------------------------------                                               

|                 |                  |          |          |          |                                               

|                 | Sample Size      |    22965 |     9369 |    13596 |                                               

|                 | Col Percent      |   100.00 |    42.53 |    57.47 |                                               

|                 | SE Col Percent   |     0.00 |     0.52 |     0.52 |                                                

-----------------------------------------------------------------------                                               


 

                                                                                                                       

                                                                                                                      

                                                                                                                       

                                               Research Triangle Institute                                  Page  : 2 

                                                 The CROSSTAB Procedure                                     Table : 2 

                                                                                                                       

Variance Estimation Method: Taylor Series (WR)                                                                        

For Subpopulation: AGECAT = 6                                                                                          

by: Had Office-Based General Checkup, Had Health Insurance in 2001.                                                   

                                                                                                                       

-----------------------------------------------------------------------                                               

|                 |                  |                                                                                 

| Had Office-     |                  | Had Health Insurance in 2001                                                   

| Based General   |                  | Total    | 1        | 2        |                                                

| Checkup         |                  |          | Insured  | Uninsur- |                                               

|                 |                  |          |          | ed       |                                                

-----------------------------------------------------------------------                                               

|                 |                  |          |          |          |                                                

| Total           | Sample Size      |    22965 |    19315 |     3650 |                                               

|                 | Col Percent      |   100.00 |   100.00 |   100.00 |                                               

|                 | SE Col Percent   |     0.00 |     0.00 |     0.00 |                                               

-----------------------------------------------------------------------                                               

|                 |                  |          |          |          |                                               

| 1 General       | Sample Size      |     9369 |     8739 |      630 |                                               

| Checkup         | Col Percent      |    42.53 |    46.12 |    17.86 |                                               

|                 | SE Col Percent   |     0.52 |     0.54 |     0.78 |                                               

-----------------------------------------------------------------------                                               

|                 |                  |          |          |          |                                               

| 2 No General    | Sample Size      |    13596 |    10576 |     3020 |                                               

| Checkup         | Col Percent      |    57.47 |    53.88 |    82.14 |                                               

|                 | SE Col Percent   |     0.52 |     0.54 |     0.78 |                                                

-----------------------------------------------------------------------                                               


 

                                AHRQ MEPS DATA USERS WORKSHOP (LINKING) -- NOV/DEC 2004                                8

                                     Link 2001 Household File and 2001 Events File

                                         Persons Age 18+ with a General Checkup

 

                   Had Health

                   Insurance

                   in 2001        N Obs    Variable    Label                        N            Mean

                   ----------------------------------------------------------------------------------

                   1 Insured       8739    ambtotpd    Total Amount Paid         8739          271.70

                                           ambfampd    Amount Paid by Family     8739           38.73

 

                   2 Uninsured      630    ambtotpd    Total Amount Paid          630          204.03

                                           ambfampd    Amount Paid by Family      630           83.54

                   ----------------------------------------------------------------------------------