Using IPUMS DHS Calendar Data to Create Event Files

IPUMS DHS allows users to download customized data files where the unit of analysis is a month in the contraceptive calendar. Sometimes users may wish to treat an event (such as a birth or spell of contraceptive use) as the unit of analysis. For example, this event-focused approach is helpful for life table analysis and for studying such topics as length of adherence to specific contraceptive methods and the timing and rate of contraceptive failure.

With events as the unit of analysis, each row in the data represents a reproductive event through the duration of the calendar.

After converting from the women-months to the women-events format, the event file will contain the following variables:

1. calcmc_ev_start
CMC start of the event
2. calcmc_ev_end
CMC end of the event
3. calreprod_allevents
Numeric recode of reproductive event
4. ev_dur_months
Duration of event in months
5. calreprod_prev_ev
Prior reproductive event
6. prev_ev_dur
Duration of prior event in months
7. calreprod_next_ev
Next reproductive event
8. next_ev_dur
Duration of next event in months

(Note: The full range of IPUMS DHS variables is also available and is unaffected by this conversion. Users may select as many or as few variables as they desire).

Table 1 provides a snapshot of how cases would look after converting from the woman-months to the woman-events format. Events are ordered from most recent to the earliest event recorded in the calendar data.

calcaseid_cmc calcmc_ev_start calcmc_ev_end calreprod_allevents ev_dur calreprod_prev_ev prev_ev_dur calreprod_next_ev next_ev_dur
12816 1_1402 1402 1402 pregnanc 1 no contraceptive use 13
12816 1_1389 1377 1389 no contr 13 injection 24 pregnancy 1
12816 1_1365 1342 1365 injectio 24 no contraceptive use 9 no contraceptive use 13
12816 1_1356 1348 1356 no contr 9 birth 1 injection 24
12816 1_1355 1355 1355 birth 1 pregnancy 8 no contraceptive use 9
12816 1_1347 1340 1347 pregnanc 8 no contraceptive use 8 birth 1
12816 1_1339 1332 1339 no contr 8 birth 1 pregnancy 8
12816 1_1338 1338 1338 birth 1 pregnancy 5 no contraceptive use 8
12816 1_1333 1329 1333 pregnanc 5 birth 1
18691 1_1389 1376 1389 no contr 14 birth 1
18691 1_1388 1388 1388 birth 1 pregnancy 8 no contraceptive use 14
18691 1_1380 1373 1380 pregnanc 8 no contraceptive use 24 birth 1
18691 1_1356 1333 1356 no contr 24 withdrawal 6 pregnancy 8
18691 1_1350 1345 1350 withdraw 6 no contraceptive use 4 no contraceptive use 24
18691 1_1346 1343 1346 no contr 4 birth 1 withdrawal 6
18691 1_1345 1345 1345 birth 1 pregnancy 8 no contraceptive use 4
18691 1_1337 1330 1337 pregnanc 8 no contraceptive use 4 birth 1
18691 1_1333 1330 1333 no contr 4 pregnancy 8

The approach suggested in Module 5 of the DHS Calendar Tutorial uses the collapse command in Stata to combine separate records for consecutive months into a single record representing an event. However, to facilitate easy use of multiple variables, IPUMS DHS proposes a different approach to reach the same end.

The general logic of converting the woman-months into events is as follows: 1) Counting total number of events. 2) Counting total number of months for each event. 3) A simple by sort keep, to preserve only one record per event. 4) Gain information about the former and the next event. 5) Generate CMC (century month codes) for start and end of event.

Step 1. Make a data file

Step 2. Open the data file.

Step 3. Prepare the data for use.

Step 4. Count the number of events

Step 5. Keep the last observation per event for each woman

Step 6. Capture information about the previous and following events

Step 7. Naming, tidying up, and saving the event file

An example:

To analyze the event file, we can quickly calculate the reason for contraceptive discontinuation in the last five years by method

		
tab calreason calreprod_allevents [iw=perweight] if calreason != 99 & intdatecmc-calcmc_ev_end < 60, col

--------------------
| Key              |
-------------------
|    frequency     |
|column percentage |
-------------------	

		    reason for |
    discontinuation of |							   numeric recode of reproductive events for woman-month
         contraceptive |      pill       iud     condom    withdrawa  female co  emergency  lactation  implants/   injection    periodic  |      Total
----------------------+--------------------------------------------------------------------------------------------------------------------------------
 became pregnant while | 26.160196   5.719049   7.000938   52.570238   1.051848   1.380446   3.359962   2.998076   29.993315   70.716725  | 234.186335
                       | 	  8.30       2.71       4.50       20.48      84.85       9.18      15.39       0.45        1.45       35.17  |       5.87
----------------------+--------------------------------------------------------------------------------------------------------------------------------
 wanted to become preg | 78.580688  87.361426  34.021649   87.320845    .187762   1.706077   9.483768 200.030927  638.743528   79.423568  |  1,238.017
					   |     24.94      41.37      21.89       34.01      15.15      11.35      43.45      30.31       30.95       39.50  |      31.03
-------------------------------------------------------------------------------------------------------------------------------------------------------
   husband disapproved |  9.517945   2.505612  18.717995   32.112938          0    .704056   1.432549   7.698788   46.155641   10.234959  | 132.505496
                       |      3.02       1.19      12.04       12.51       0.00       4.68       6.56       1.17        2.24        5.09  |       3.32
-------------------------------------------------------------------------------------------------------------------------------------------------------
 lack of access/availa |   1.33521          0   3.323564           0          0          0   1.481831   2.163824   20.685938           0  |  28.988678
					   |      0.42       0.00       2.14        0.00       0.00       0.00       6.79       0.33        1.00        0.00  |       0.73
-------------------------------------------------------------------------------------------------------------------------------------------------------
                  cost |         0          0   1.292885		   0		  0			 0			0	1.188386	  	   0  		   0  |   2.481271
				       |	  0.00		 0.00		0.83		0.00	   0.00		  0.00		 0.00       0.18		0.00		0.00  |       0.06
-------------------------------------------------------------------------------------------------------------------------------------------------------
			fatalistic |  3.830159   6.190334   	   0		   0		  0			 0			0  15.484339   25.171299		   0  |  50.676131
					   |	  1.22		 2.93		0.00		0.00	   0.00		  0.00		 0.00	    2.35	    1.22		0.00  |       1.27
-------------------------------------------------------------------------------------------------------------------------------------------------------
		  side effects |109.140817   66.26268   8.852992     .804099   		  0	  5.540994			0 289.941605  841.771695		   0  |  1,324.944
					   |	 34.64		31.38		5.70		0.31	   0.00		 36.87		 0.00	   43.93	   40.79		0.00  | 	 33.21
-------------------------------------------------------------------------------------------------------------------------------------------------------
 wanted more effective | 21.020382  10.753556  18.694208   25.120335   		  0	  1.510642	 1.000309  38.625556  106.964656    6.737573  | 236.282917
					   |      6.67		 5.09	   12.03		9.78	   0.00      10.05       4.58		5.85		5.18		3.35  |		  5.92
-------------------------------------------------------------------------------------------------------------------------------------------------------
   inconvenient to use |   14.32757   7.024353   14.57675   16.236289		  0			 0			0  21.358232   49.797218   12.989205  | 139.739624
					   |	   4.55		  3.33		 9.38		 6.32	   0.00		  0.00       0.00   	3.24		2.41		6.46  |       3.50
-------------------------------------------------------------------------------------------------------------------------------------------------------
 infrequent sex/husban |  10.130525	 10.719979	25.544178     8.81291		  0	  2.737666	 2.546294   15.56093   93.737817    3.418144  | 178.082551
					   |	   3.22		  5.08		16.43		 3.43	   0.00		 18.22		11.66		2.36		4.54		1.70  |       4.46
-------------------------------------------------------------------------------------------------------------------------------------------------------
 difficult to get preg |		  0		 3.491 	  .425002		    0		  0			 0			0   2.400139	7.303679		   0  |   13.61982 
					   |	   0.00		  1.65		 0.27		 0.00	   0.00		  0.00		 0.00       0.36        0.35		0.00  |       0.34
-------------------------------------------------------------------------------------------------------------------------------------------------------
   marital dissolution |   8.166641   1.230794   2.688733      .70605		  0			 0			0   4.275521   38.045966		   0  |  55.113705
					   |	   2.59		  0.58		 1.73		 0.28	   0.00		  0.00		 0.00		0.65		1.84		0.00  |       1.38
-------------------------------------------------------------------------------------------------------------------------------------------------------
		  other reason |  19.609398	  7.724039  17.079134    6.764132		  0    .202048   2.523998  49.844602  135.553324	6.265354  | 251.428352
					   |	   6.22		  3.66 		10.99		 2.63 	   0.00		  1.34		11.56		7.55		6.57		3.12  | 	  6.30
-------------------------------------------------------------------------------------------------------------------------------------------------------
           do not know |  13.256051   2.179981   3.219721   26.281595		  0   1.247746			0   8.410382   29.732381    11.29803  | 104.008108
					   |	   4.21		  1.03		 2.07		10.24	   0.00		  8.30		 0.00		1.27		1.44		5.62  |		  2.61
-------------------------------------------------------------------------------------------------------------------------------------------------------
				 Total | 315.073893 211.162803 155.437749  256.729431   1.23961  15.029675  21.828711 659.981307   2,063.656  201.083557  |  3,990.074
					   |	 100.00		100.00	   100.00	   100.00    100.00		100.00	   100.00	  100.00	  100.00	  100.00  | 	100.00
					   
			reason for |   numeric recode of reproductive
    discontinuation of |	 events for woman-month
         contraceptive |  standard    other mod  other tra  |      Total
-----------------------+-------------------------------------------------
 became pregnant while | 28.844256     1.414886   2.976401  | 234.186335
                       | 	 39.13	 	  60.03		 23.29  |       5.87
-----------------------+-------------------------------------------------
 wanted to become preg | 21.157221			  0			 0  |  1,238.017
					   |     28.70		   0.00		  0.00  |      31.03
-----------------------+-------------------------------------------------
   husband disapproved |  3.425013    		  0			 0  | 132.505496
                       |      4.65		   0.00		  0.00  |       3.32
-----------------------+-------------------------------------------------
 lack of access/availa |         0            0          0  |  28.988678
					   |      0.00         0.00       0.00  |       0.73
-----------------------+-------------------------------------------------
                  cost |         0            0   	     0  |   2.481271
				       |	  0.00		   0.00		  0.00	|       0.06
-----------------------+-------------------------------------------------
			fatalistic |  	     0		      0		     0  |  50.676131
					   |	  0.00		   0.00	      0.00	|       1.27
-----------------------+-------------------------------------------------
		  side effects |   2.62909		      0	 	     0  |  1,324.944
					   |	  3.57         0.00		  0.00  | 	   33.21
-----------------------+-------------------------------------------------
 wanted more effective |    5.8557		      0 		 0	| 236.282917
					   |      7.94		   0.00   	  0.00  |		5.92
-----------------------+-------------------------------------------------
   inconvenient to use |   .800917			  0	   2.62909  | 139.739624
					   |	  1.09  	   0.00      20.57	|       3.50
-----------------------+-------------------------------------------------
 infrequent sex/husban |  4.874108  		  0	         0  | 178.082551
					   |	  6.61  	   0.00		  0.00  |       4.46
-----------------------+-------------------------------------------------
 difficult to get preg |		  0			 0			0   |   13.61982 
					   |	   0.00		  0.00		 0.00   |       0.34
-----------------------+-------------------------------------------------
   marital dissolution |    	  0			 0			0   |  55.113705
					   |	   0.00		  0.00		 0.00	|       1.38
-----------------------+-------------------------------------------------
		  other reason |    	  0    		 0	 5.862323   | 251.428352
					   |	   0.00		  0.00		45.86   | 	    6.30
-----------------------+-------------------------------------------------
           do not know |   6.125526     .94215   1.314545   | 104.008108
					   |	   8.31      39.97		10.28   |		2.61
-----------------------+-------------------------------------------------
				 Total |  73.711831   2.357036	12.782359	|  3,990.074
					   |     100.00     100.00     100.00   |     100.00
		
	
Back to top