Skip to main content
U.S. flag
Health and Human Services Logo

An official website of the Department of Health & Human Services

menu-iconMore mobile-close-icon
mobile-back-btn-icon Back
  • menu-iconMenu
  • mobile-search-icon
AHRQ: Agency for Healthcare Research and Quality
  • Search All AHRQ Sites
  • Careers
  • Contact Us
  • Español
  • FAQs
  • Email Updates
MEPS Home Medical Expenditure Panel Survey
Font Size:
Contact MEPS FAQ Site Map  
S
M
L
XL
MEPS HC-063: Appendix 1 | << previous page



Appendix 1: Sample SAS Program

1                                             The SAS System                 17:35 Thursday, March 4, 2004
NOTE: Copyright (c) 1999-2001 by SAS Institute Inc., Cary, NC, USA. 
NOTE: SAS (r) Proprietary Software Release 8.2 (TS2M0)
1                  /* APP02.sas */
2          
3                    OPTIONS LS=132 PS=79;
4          
5                  /******************************************************************************/
6                  /*   Program Name:  SAMPLE.SAS                                                */
7                  /*                                                                            */
8                  /*   Description:   This job provides an example of how to get job info       */
9                  /*                  from Round 1 or Round 2 in the FY2001 JOBS file when      */
10                 /*                  a Round 3 current main job in the FY2002 JOBS file        */
11                 /*                  is a continuation job.                                    */
12                 /*                                                                            */
13                 /*                  This example creates a dataset of Round 3 continuation    */
14                 /*                  JOBS records with a SICKPAYX variable copied from the     */
15                 /*				       Round 1 or Round 2 newly reported job*/
16                  /******************************************************************************/
17         
18                  libname  jobs02  "c:\mydata\jobs02";
NOTE: Libref JOBS02 was successfully assigned as follows: 
      Engine:        V8 
      Physical Name: c:\mydata\jobs02
19                  libname  jobs01   "c:\mydata\jobs01";
NOTE: Libref JOBS01 was successfully assigned as follows: 
      Engine:        V8 
      Physical Name: "c:\mydata\jobs01"
20         
21               /*  Select continuing Panel 6, Round 3 Current Main JOBS        */
22                 /*  (SUBTYPE=1, STILLAT=1) from the FY 2002 JOBS file and       */
23                 /*  print selected variables from the first 20 observations     */
24         		
25                  data j02r3;
26                  	     set jobs02.h63;
27         		   if 	panel=6
28         		   and	rn=3
29         		   and	subtype=1
30         		   and	stillat=1
31         		   and	sickpay=-1;
32                  run;
NOTE: There were 67028 observations read from the data set JOBS02.JOBS02.
NOTE: The data set WORK.J02R3 has 8401 observations and 88 variables.
NOTE: DATA statement used:
      real time           2.76 seconds
      cpu time            0.26 seconds      
33         
34                  proc print data=j02r3 (obs=20);
35                  	title 'Print Sample of Continuation Round 3 Records';
36                         var dupersid panel rn jobsn subtype stillat sickpay;
37                  run;
NOTE: There were 20 observations read from the data set WORK.J02R3.
NOTE: The PROCEDURE PRINT printed page 1.
 
 2                                            The SAS System                  17:35 Thursday, March 4, 2004
NOTE: PROCEDURE PRINT used:
      real time           0.25 seconds
      cpu time            0.04 seconds  
38         
39         
40                  /*  Select newly reported Panel 6 Current Main JOBS records from          */
41         	      /*  the FY 2001 JOBS file and print selected variables from the   */
42         	      /*  first 20 observations.                                        */
43         
44                  data j0112;
45                       set jobs01.h56;
46                       if      subtype=1
47                       and     stillat=-1
48                       and     panel=6
49                       and     rn in (1,2);
50                  run;
NOTE: There were 61265 observations read from the data set JOBS01.JOBS01.
NOTE: The data set WORK.J0112 has 11957 observations and 83 variables.
NOTE: DATA statement used:
      real time           2.25 seconds
      cpu time            0.43 seconds      
51         		
52                  proc print data=j0112 (obs=20);
53                       title 'Print Sample of Newly Reported Round 1 and Round 2 Records';
54                       var dupersid panel rn jobsn subtype stillat sickpay;
55                  run;
NOTE: There were 20 observations read from the data set WORK.J0112.
NOTE: The PROCEDURE PRINT printed page 2.
NOTE: PROCEDURE PRINT used:
      real time           0.00 seconds
      cpu time            0.00 seconds      
56         		
57                  proc freq data=j0112;
58                       tables sickpay/list missing;
59                       title 'Sickpay Value of FY2001 Round 1 and Round 2 Newly Reported CMJs';
60                  run;
NOTE: There were 11957 observations read from the data set WORK.J0112.
NOTE: The PROCEDURE FREQ printed page 3.
NOTE: PROCEDURE FREQ used:
      real time           0.07 seconds
      cpu time            0.00 seconds      
61         		
62         		
63                  /*  Prepare FY01 and FY02 data for merge                  			*/
64         		
65                  proc sort data=j02r3;
66                       by dupersid jobsn;
67                  run;
NOTE: There were 8401 observations read from the data set WORK.J02R3.
NOTE: The data set WORK.J02R3 has 8401 observations and 88 variables.
NOTE: PROCEDURE SORT used:
      real time           0.25 seconds
      cpu time            0.21 seconds      
68         		
69                  proc sort data=j0112;
70                       by dupersid jobsn;
71                  run;
NOTE: There were 11957 observations read from the data set WORK.J0112.
NOTE: The data set WORK.J0112 has 11957 observations and 83 variables.
NOTE: PROCEDURE SORT used:
      real time           0.32 seconds
      cpu time            0.31 seconds
 
 3                                            The SAS System                  17:35 Thursday, March 4, 2004      
72         		
73         		
74         		
75                   /*  Create a dataset (J02R3F) that includes all variables         */
76                   /*  for the continuation Round 3 Current Main JOBS and create 	*/
77         	       /*  the new variable SICKPAYX by copying SICKPAY from the 		*/
78         	       /*  corresponding Round 1 or Round 2 newly reported job record.   */
79         		
80                   data j02r3f;
81                        merge j02r3 (in=a) j0112 (in=b  keep = dupersid jobsn sickpay
82         			rename=(sickpay=SICKPAYX));
83                        by dupersid jobsn;
84                        if a and b;
85                   run;
NOTE: There were 8401 observations read from the data set WORK.J02R3.
NOTE: There were 11957 observations read from the data set WORK.J0112.
NOTE: The data set WORK.J02R3F has 8401 observations and 89 variables.
NOTE: DATA statement used:
      real time           0.18 seconds
      cpu time            0.17 seconds      
86         		
87                   proc freq data=j02r3f;
88                        tables sickpay*sickpayx/list missing;
89                        title1  'Diagnostic Post-Merge - Sickpay * Sickpayx';
90                        title2  'Round 3 Continuation Current Main Jobs Only';
91                   run;
NOTE: There were 8401 observations read from the data set WORK.J02R3F.
NOTE: The PROCEDURE FREQ printed page 4.
NOTE: PROCEDURE FREQ used:
      real time           0.03 seconds
      cpu time            0.01 seconds
      
92         		
93                   OPTIONS LS=132 PS=79;
94             	
95         		  /******************************************************************/
 
                        Print Sample of Continuation Round 3 Records           17:35 Thursday, March 4, 2004   1
          Obs    DUPERSID    PANEL    RN    JOBSN    SUBTYPE    STILLAT    SICKPAY
            1    46125018      6       3      1          1          1         -1  
            2    46125025      6       3      1          1          1         -1  
            3    46125055      6       3      1          1          1         -1  
            4    43857022      6       3      1          1          1         -1  
            5    44294012      6       3      1          1          1         -1  
            6    44294029      6       3      1          1          1         -1  
            7    43167018      6       3      1          1          1         -1  
            8    43167025      6       3      1          1          1         -1  
            9    43167032      6       3      1          1          1         -1  
           10    46914015      6       3      1          1          1         -1  
           11    46563029      6       3      1          1          1         -1  
           12    41695019      6       3      1          1          1         -1  
           13    43854016      6       3      1          1          1         -1  
           14    43854023      6       3      2          1          1         -1  
           15    43620025      6       3      1          1          1         -1  
           16    49616019      6       3      1          1          1         -1  
           17    49616026      6       3      1          1          1         -1  
           18    47081012      6       3      1          1          1         -1  
           19    47081029      6       3      1          1          1         -1  
           20    47925019      6       3      1          1          1         -1  
 
                 Print Sample of Newly Reported Round 1 and Round 2 Records    17:35 Thursday, March 4, 2004   2
           Obs    DUPERSID    PANEL    RN    JOBSN    SUBTYPE    STILLAT    SICKPAY
             1    40006015      6       1      1          1         -1          1  
             2    40006022      6       2      1          1         -1          1  
             3    40007015      6       1      1          1         -1          2  
             4    40010015      6       1      1          1         -1          1  
             5    40010039      6       1      1          1         -1          2  
             6    40011013      6       2      1          1         -1          2  
             7    40012018      6       1      1          1         -1          1  
             8    40012018      6       2      2          1         -1          1  
             9    40015018      6       1      1          1         -1          1  
            10    40016014      6       1      1          1         -1          1  
            11    40017019      6       1      1          1         -1          1  
            12    40018018      6       2      1          1         -1          2  
            13    40018035      6       1      1          1         -1         -1  
            14    40018035      6       2      2          1         -1          2  
            15    40019022      6       1      1          1         -1          1  
            16    40020010      6       1      1          1         -1          1  
            17    40020027      6       1      1          1         -1         -1  
            18    40023018      6       1      1          1         -1          1  
            19    40023025      6       1      1          1         -1          1  
            20    40025014      6       1      1          1         -1          2  
 
              Sickpay Value of FY2001 Round 1 and Round 2 Newly Reported CMJs                                  3
                                                                                   17:35 Thursday, March 4, 2004
                                     The FREQ Procedure
                              DOES PERSON HAVE PAID SICK LEAVE
 
                                                    Cumulative    Cumulative
                SICKPAY    Frequency     Percent     Frequency      Percent
                ------------------------------------------------------------
                     -9          14        0.12            14         0.12  
                     -8         254        2.12           268         2.24  
                     -7          11        0.09           279         2.33  
                     -1        1364       11.41          1643        13.74  
                      1        5817       48.65          7460        62.39  
                      2        4497       37.61         11957       100.00  
 
                         Diagnostic Post-Merge - Sickpay * Sickpayx            17:35 Thursday, March 4, 2004   4
                        Round 3 Continuation Current Main Jobs Only
                                     The FREQ Procedure
                                                                Cumulative    Cumulative
                SICKPAY    SICKPAYX    Frequency     Percent     Frequency      Percent
                ------------------------------------------------------------------------
                     -1          -9           8        0.10             8         0.10  
                     -1          -8         130        1.55           138         1.64  
                     -1          -7           5        0.06           143         1.70  
                     -1          -1        1072       12.76          1215        14.46  
                     -1           1        4592       54.66          5807        69.12  
                     -1           2        2594       30.88          8401       100.00  
 
<< previous page