Epidemiology & Technology

Stata Code for generating corneal opacity outcomes from RAAB 6 surveys

The following Stata code can be used:

Generating PVA Better eye variable
tab1 status
gen enrol = status==1
egen pvaBetter = rowmin(pvare pvale) if enrol==1
egen pvaWorse = rowmax(pvare pvale) if enrol==1
Codes for vision
	   1   Can see 6/12
           2   Can see 6/18, Cannot see 6/12
           3   Can see 6/60, Cannot see 6/18
           4   Can see 3/60, Cannot see 6/60
           5   Can see 1/60, Cannot see 3/60
           6   PL+, Cannot see 1/60
           7   PL-
           9   Missing	    
Codes for Cause of vision loss

           1   Refractive error
           2   Aphakia, uncorrected
           3   Cataract, untreated
           4   Cataract surg. complications
           5   Trachoma corneal opacity
           6   Other corneal opacity
           7   Phthisis
           8   Others/Undetermined
           9   Glaucoma
          10   Diabetic retinopathy
          11   ARMD
          12   Other posterior segment
          13   All globe/CNS abnormalities
          14   Not examined: can see 6/12
          99   Missing
    
****************************************************************************************
** BLINDNESS OR VI IN PERSON WITH U/L, B/L or any Eye COs
*** The next set of variables identify 
*** those persons in whom CO is marked as the cause of PVA < 6/12 in one, two or any eye  
****** among persons who are at a specified threshold of PVA in better eye 

** This set of variables ignore cause of VI in the fellow eye
** Also, the PVA in CO afflicted eye is not taken into account. Only PVA better eye in person is taken into account

/* 
A. CO as cause of VI at 6/12 PVA threshold
PVA < 6/12 IN BETTER EYE AND 
1.	U/L CO: one eye has cause as CO as cause of VI – means both BCVA and PVA in that eye were worse than 6/12
2.	B/L CO: Both eye have CO as cause of VI – means both BCVA and PVA in both eye were worse than 6/12
3.	No CO: No eye has CO as cause of VI – may have no VI or may have other cause of VI
*/
cap drop coVi612
gen     coVi612 = 0
replace coVi612 = 2 if ///
		inlist(pvaBetter,2,3,4,5,6,7) &  ///
		(inlist(causere,5,6)  &  inlist(causele,5,6) ) & ///
		coVi612==0 
replace coVi612 = 1 if ///
		inlist(pvaBetter,2,3,4,5,6,7) & ///
		(inlist(causere,5,6)  |  inlist(causele,5,6) ) & ///
		coVi612==0
label var coVi612 "CO marked as cause in persons with PVA<6/12 Better Eye" 
label define coVi612 0 "No CO" 1 "U/L CO" 2 "B/L CO", replace
label value coVi612 coVi612
tab coVi612  
bysort coVi612: tab2   causere causele, nol
bysort coVi612: tab   prcause, nol

gen coVi612Ul       = coVi612==1
gen coVi612Bl      = coVi612==2
gen coVi612AnyEye = coVi612==1 | coVi612==2

label var  coVi612Ul      "Ul-CO marked as cause of PVA < 6/12 in persons with PVA < 6/12"
label var  coVi612Bl      "Bl-CO marked as cause of PVA < 6/12 in persons with PVA < 6/12"
label var  coVi612AnyEye  "Any eye CO marked as cause of PVA < 6/12 in persons with PVA < 6/12"
label define  coVi612Ul        0    "Not CO as cause of VI in one eye" 1 "Ul-CO marked as cause of PVA < 6/12 in persons with PVA < 6/12"
label value   coVi612Ul     coVi612Ul
label define  coVi612Bl       0  "Not CO as cause of VI in one eye" 1     "Bl-CO marked as cause of PVA < 6/12 in persons with PVA < 6/12"
label value   coVi612Bl     coVi612Bl
label define  coVi612AnyEye     0  "Not CO as cause of VI in any eye"  1  "Any eye CO marked as cause of PVA < 6/12 in persons with PVA < 6/12"
label value   coVi612AnyEye coVi612AnyEye



/*    A2. CO as cause of VI  at 6/18 PVA threshold */
cap drop coVi618
gen     coVi618 = 0
replace coVi618 = 2 if ///
		inlist(pvaBetter,3,4,5,6,7) &  ///
		(inlist(causere,5,6)  &  inlist(causele,5,6) ) & ///
		coVi618==0 
replace coVi618 = 1 if ///
		inlist(pvaBetter,3,4,5,6,7) & ///
		(inlist(causere,5,6)  |  inlist(causele,5,6) ) & ///
		coVi618==0
label var coVi618  "CO marked as cause in persons with PVA<6/18 Better Eye"  
label define coVi618 0 "No CO" 1 "U/L CO" 2 "B/L CO", replace
label value coVi618 coVi618
tab coVi618  
bysort coVi618: tab2   causere causele, nol
bysort coVi618: tab   prcause, nol

gen coVi618Ul       = coVi618==1
gen coVi618Bl      = coVi618==2
gen coVi618AnyEye = coVi618==1 | coVi618==2

label var     coVi618Ul     "Ul-CO marked as cause of PVA < 6/12 in persons with PVA < 6/18"
label var     coVi618Bl     "Bl-CO marked as cause of PVA < 6/12 in persons with PVA < 6/18"
label var     coVi618AnyEye  "Any eye CO marked as cause of PVA < 6/12 in persons with PVA < 6/18"
label define  coVi618Ul        0    "Not CO as cause of MSVIB in one eye" 1  "Ul-CO marked as cause of PVA < 6/12 in persons with PVA < 6/18"
label value   coVi618Ul     coVi618Ul
label define  coVi618Bl       0  "Not CO as cause of MSVIB in one eye" 1     "Bl-CO marked as cause of PVA < 6/12 in persons with PVA < 6/18"
label value   coVi618Bl     coVi618Bl
label define  coVi618AnyEye     0  "Not CO as cause of MSVIB in any eye"  1  "Any eye CO marked as cause of PVA < 6/12 in persons with PVA < 6/18"
label value   coVi618AnyEye coVi618AnyEye


/* CO as cause of VI or blindness at 6/60 PVA threshold */
cap drop coVi660
gen     coVi660 = 0
replace coVi660 = 2 if ///
		inlist(pvaBetter,4,5,6,7) &  /// PVA , 6/60
		(inlist(causere,5,6)  &  inlist(causele,5,6) ) & ///
		coVi660==0 
replace coVi660 = 1 if ///
		inlist(pvaBetter,4,5,6,7) & ///
		(inlist(causere,5,6)  |  inlist(causele,5,6) ) & ///
		coVi660==0
label var coVi660 "CO marked as cause in persons with PVA<6/60 Better Eye" 
label define coVi660 0 "No CO" 1 "U/L CO" 2 "B/L CO", replace
label value coVi660 coVi660
tab coVi660  
bysort coVi660: tab2   causere causele, nol
bysort coVi660: tab   prcause, nol

gen coVi660Ul       = coVi660==1
gen coVi660Bl       = coVi660==2
gen coVi660AnyEye   = coVi660==1 | coVi660==2

label var  coVi660Ul      "Ul-CO marked as cause of PVA < 6/12 in persons with PVA < 6/60"
label var  coVi660Bl      "Bl-CO marked as cause of PVA < 6/12 in persons with PVA < 6/60"
label var  coVi660AnyEye  "Any eye CO marked as cause of PVA < 6/12 in persons with PVA < 6/60"
label define  coVi660Ul        0    "Not CO as cause of SVIB in one eye" 1 "Ul-CO marked as cause of PVA < 6/12 in persons with PVA < 6/60"
label value   coVi660Ul     coVi660Ul
label define  coVi660Bl       0  "Not CO as cause of SVIB in one eye" 1     "Bl-CO marked as cause of PVA < 6/12 in persons with PVA < 6/60"
label value   coVi660Bl     coVi660Bl
label define  coVi660AnyEye     0  "Not CO as cause of SVIB in any eye"  1  "Any eye CO marked as cause of PVA < 6/12 in persons with PVA < 6/60"
label value   coVi660AnyEye coVi660AnyEye


/* CO as cause of VI or Blindness  at 3/60 PVA threshold */
cap drop coVi360
gen     coVi360 = 0
replace coVi360 = 2 if ///
		inlist(pvaBetter,5,6,7) &  ///
		(inlist(causere,5,6)  &  inlist(causele,5,6) ) & ///
		coVi360==0 
replace coVi360 = 1 if ///
		inlist(pvaBetter,5,6,7) & ///
		(inlist(causere,5,6)  |  inlist(causele,5,6) ) & ///
		coVi360==0
label var coVi360 "CO as cause of PVA<3/60 in eyes" 
label define coVi360 0 "No CO" 1 "U/L CO" 2 "B/L CO", replace
label value coVi360 coVi360
tab coVi360  
bysort coVi360: tab2   causere causele, nol
bysort coVi360: tab   prcause, nol

gen coVi360Ul       = coVi360==1
gen coVi360Bl      = coVi360==2
gen coVi360AnyEye = coVi360==1 | coVi360==2

label var  coVi360Ul      "Ul-CO marked as cause of PVA < 6/12 in persons with PVA < 3/60"
label var  coVi360Bl      "Bl-CO marked as cause of PVA < 6/12 in persons with PVA < 3/60"
label var  coVi360AnyEye  "Any eye CO marked as cause of PVA < 6/12 in persons with PVA < 3/60"
label define  coVi360Ul        0    "Not CO as cause of Blindness in one eye" 1 "Ul-CO marked as cause of PVA < 6/12 in persons with PVA < 3/60"
label value   coVi360Ul     coVi360Ul
label define  coVi360Bl       0  "Not CO as cause of Blindness in one eye" 1     "Bl-CO marked as cause of PVA < 6/12 in persons with PVA < 3/60"
label value   coVi360Bl     coVi360Bl
label define  coVi360AnyEye     0  "Not CO as cause of Blindness in any eye"  1  "Any eye CO marked as cause of PVA < 6/12 in persons with PVA < 3/60"
label value   coVi360AnyEye coVi360AnyEye



************************************************************************
* Persons with PREVENTABLE BLINDNESS OR VI DUE TO COs
*** It may happen that persons with one eye CO may have a more preventable / treatable cause in other eye
*** The next set of variables identify those persons in whom CO is marked as cause at specified PVA threhold in that eye, 
*** and the fellow eye has a less avoidable /treatable cause
******* among persons who are at a specified threshold of PVA in better eye 

** This set of variables DO NOT ignore  cause of VI in  the fellow eye
** Also, the PVA in CO afflicted eye IS taken into account. 
** Thereby these overcome some of the limitations of previous set of variables

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

/*
B1. Prevalence of CO associated Preventable VI or Blindness at 6/12 PVA threshold – preventable /avoidable VI/Blindness due to CO
   PVA < 6/12 IN BETTER EYE AND 
   CO the more preventable / avoidable cause of VIB  in person 
– RAAB protocol ensures that these have PVA worse than 6/12 in better eye
*/ 

cap drop coVi612prev
gen coVi612prev = 0
replace coVi612prev = 1 if inlist(pvaBetter,2,3,4,5,6,7) & (inlist(prcause,5,6))  & coVi612prev==0 
tab coVi612prev //  275
tab coVi612prev coVi612
label var  coVi612prev 		    "CO main cause of PVA < 6/12 in person" 
label define  coVi612prev   0    "Not Preventable VIB  due to CO" 1 "CO main cause of PVA < 6/12 in person"
label value   coVi612prev     coVi612prev

/* B2. Prevalence of CO associated Blindness at 6/18 PVA threshold  – preventable /avoidable  Blindness due to CO  */
cap drop coVi618prev
gen coVi618prev = 0
replace coVi618prev = 1 if ///
	inlist(pvaBetter,3,4,5,6,7) & /// Person has MSVI or blindness, AND
	 ( /// One of the following three conditions are met
	   (  inlist(causere, 5,6) & inlist(pvare, 3,4,5,6,7) & inlist(causele,7,8,9,10,11,12,13)  )   |  /// 1. Right eye has CO (5,6) and Rt pva < 6/18 and Left eye has less avoidable cause of PVA < 6/12 (7-13) OR 
	   (  inlist(causele, 5,6) & inlist(pvale, 3,4,5,6,7) & inlist(causere,7,8,9,10,11,12,13)  )   |  /// 2. Left eye has CO (5,6) and Lt pva < 6/18 and Right eye has less avoidable cause of PVA < 6/12  (7-13) OR 
	   (  inlist(causere, 5,6) & inlist(pvare, 3,4,5,6,7) & inlist(causele, 5,6) & inlist(pvale, 3,4,5,6,7)   )		/// 3. BOTH Right eye has CO pva < 6/18,  Left eye has CO (5,6) pva < 6/18   
	  )
tab coVi618prev
tab coVi618prev coVi618
label var  coVi618prev  "CO main cause of PVA < 6/18 in person"
label define  coVi618prev        0    "Not Preventable MSVIB due to CO" 1 "CO main cause of PVA < 6/18 in person"
label value   coVi618prev     coVi618prev


/* B3. Prevalence of CO associated preventable /avoidable Blindness at 6/60 PVA threshold  */
cap drop coVi660prev
gen coVi660prev = 0
replace coVi660prev = 1  if ///
	inlist(pvaBetter,4,5,6,7) & ///
	 ( ///
	   (  inlist(causere, 5,6) & inlist(pvare, 4,5,6,7) & inlist(causele,7,8,9,10,11,12,13)  )   |  /// Right eye has CO (5,6) and rt pva < 6/60  and Left eye has (7-13) OR 
	   (  inlist(causele, 5,6) & inlist(pvale, 4,5,6,7) & inlist(causere,7,8,9,10,11,12,13)  )   |  /// Left eye has CO (5,6) and Lt pva < 6/60   , Right eye has (7-13) OR 
	   (  inlist(causere, 5,6) & inlist(pvare, 4,5,6,7) & inlist(causele, 5,6) & inlist(pvale, 4,5,6,7)   )		/// Right eye has CO (5,6) pva < 6/60  ,  Left eye has CO (5,6) pva < 6/60 
	  )
tab coVi660prev //  275
tab coVi660prev coVi660
label var  coVi660prev "CO main cause of PVA < 6/60 in person" 
label define  coVi660prev        0    "Not Preventable SVIB due to CO" 1 "CO main cause of PVA < 6/60 in person"
label value   coVi660prev     coVi660prev

/* B4. Prevalence of CO associated preventable /avoidable Blindness at 3/60 PVA threshold  */
cap drop coVi360prev
gen coVi360prev = 0
replace coVi360prev = 1 if ///
	inlist(pvaBetter,5,6,7) & ///
	 ( ///
	   (  inlist(causere, 5,6) & inlist(pvare, 5,6,7) & inlist(causele,7,8,9,10,11,12,13)  )   |  /// Right eye has CO (5,6) and rt pva < 3/60  and Left eye has (7-13) OR 
	   (  inlist(causele, 5,6) & inlist(pvale, 5,6,7) & inlist(causere,7,8,9,10,11,12,13)  )   |  /// Left eye has CO (5,6) and Lt pva < 3/60  , Right eye has (7-13) OR 
	   (  inlist(causere, 5,6) & inlist(pvare, 5,6,7) & inlist(causele, 5,6) & inlist(pvale, 5,6,7)   )		/// Right eye has CO (5,6) pva < 3/60 ,  Left eye has CO (5,6) pva < 3/60  
	  )
	  
tab coVi360prev //  177
label var  coVi360prev "CO main cause of PVA < 3/60 in person" 
label define  coVi360prev        0    "Not Preventable Blindness due to CO" 1 "CO main cause of PVA < 3/60 in person"
label value   coVi360prev     coVi360prev



************************************************************************
* Persons with Surgically TREATABLE BLINDNESS OR VI DUE TO COs - 
*** It may happen that persons with CO may have PL-ve vision and therefore are non-treatable by keratoplasty services. 

*** The next set of variables identify those persons in whom CO is marked at the more preventable cause at specified PVA threhold in that eye, 
*** and the CO affected eye has PL+ve vision
*** and the fellow eye has a less avoidable /treatable cause and may be PL-ve
******* among persons who are at a specified threshold of PVA in better eye 

** This set of variables DO NOT ignore  cause of VI in  the fellow eye
** Also, the PVA in CO afflicted eye and PL+ positivity IS taken into account. 
** Thereby these overcome some of the limitations of previous set of variables

****************************************************************************
	
/*
C1. Prevalence of surgically amenable CO associated VI or Blindness at 6/12 pva threshold 
PVA < 6/12 IN BETTER EYE AND 
-	Right eye has CO and is PL+ and left eye is 7-13
-	Left eye has CO and is PL+ and Right eye is 7-13
-	Both eyes have CO and one eye is PL+
*/
cap drop coVi612prevSurg
gen coVi612prevSurg = 0
replace coVi612prevSurg = 1 if ///
	inlist(pvaBetter,2,3,4,5,6,7) & ///
	 ( ///
	   (  inlist(causere, 5,6) & inlist(pvare, 2,3,4,5,6) & inlist(causele,7,8,9,10,11,12,13) & inlist(pvale, 2, 3,4,5,6,7)  )   |  /// Right eye has CO and is PL+ and left eye is 7-13
	   (  inlist(causele, 5,6) & inlist(pvale, 2,3,4,5,6) & inlist(causere,7,8,9,10,11,12,13)  & inlist(pvare, 2, 3,4,5,6,7) )   |  /// Left eye has CO and is PL+ and Right eye is 7-13
	   (  inlist(causere, 5,6) & inlist(causele, 5,6)  & inlist(pvare, 2,3,4,5,6,7)  & inlist(pvale, 2,3,4,5,6,7) &  (inlist(pvale,1,2,3,4,5,6) | inlist(pvare,1,2,3,4,5,6))   )	/// Both eyes have CO and both eye cannot see PVA  6/12 and one eye is PL+  
	  )
tab coVi612prevSurg

//C2. Prevalence of surgically amenable CO associated VI or Blindness at 6/18 pva threshold 
cap drop coVi618prevSurg
gen coVi618prevSurg = 0
replace coVi618prevSurg = 1 if ///
	inlist(pvaBetter,3,4,5,6,7) & ///
	 ( ///
	   (  inlist(causere, 5,6) & inlist(pvare, 3,4,5,6) & inlist(causele,7,8,9,10,11,12,13)  & inlist(pvale, 3,4,5,6,7)  )   |  /// Right eye has CO and cannot see PVA  6/18 and is PL+; left eye is 7-13 and cannot see PVA  6/18
	   (  inlist(causele, 5,6) & inlist(pvale, 3,4,5,6) & inlist(causere,7,8,9,10,11,12,13)  & inlist(pvare, 3,4,5,6,7)  )   |  /// Left eye has CO and is PL+ and cannot see PVA 6/18 and; Right eye is 7-13 and cannot see PVA  6/18
	   (  inlist(causere, 5,6) & inlist(causele, 5,6) & inlist(pvare, 3,4,5,6,7)  & inlist(pvale, 3,4,5,6,7) &    (inlist(pvale,1,2,3,4,5,6) | inlist(pvare,1,2,3,4,5,6))    )	/// Both eyes have CO and both eye cannot see PVA  6/18 and one eye is PL+
	 )  
tab coVi618prevSurg	
	
// C3. Prevalence of surgically amenable CO associated VI or Blindness at 6/60 pva threshold 
cap drop coVi660prevSurg
gen coVi660prevSurg = 0
replace coVi660prevSurg = 1 if ///
	inlist(pvaBetter,4,5,6,7) & ///
	 ( ///
	   (  inlist(causere, 5,6) & inlist(pvare, 4,5,6) & inlist(causele,7,8,9,10,11,12,13)  & inlist(pvale, 4,5,6,7)  )   |  /// Right eye has CO and cannot see PVA  6/60 and is PL+; left eye is 7-13 and cannot see PVA  6/60
	   (  inlist(causele, 5,6) & inlist(pvale, 4,5,6) & inlist(causere,7,8,9,10,11,12,13)  & inlist(pvare, 4,5,6,7)  )   |  /// Left eye has CO and is PL+ and cannot see PVA 6/60 and; Right eye is 7-13 and cannot see PVA  6/60
	   (  inlist(causere, 5,6) & inlist(causele, 5,6) & inlist(pvare, 4,5,6,7)  & inlist(pvale, 4,5,6,7) &   (inlist(pvale,1,2,3,4,5,6) | inlist(pvare,1,2,3,4,5,6))   )	/// Both eyes have CO and both eye cannot see PVA  6/60 and one eye is PL+
	  )
tab coVi660prevSurg		

				
// C4. Prevalence of surgically amenable CO associated VI or Blindness at 3/60 pva threshold 			
cap drop coVi360prevSurg
gen coVi360prevSurg = 0
replace coVi360prevSurg = 1 if ///
	inlist(pvaBetter,5,6,7) & ///
	(  ///
	   (  inlist(causere, 5,6) & inlist(pvare, 5,6) & inlist(causele,7,8,9,10,11,12,13)  & inlist(pvale, 5,6,7)  )   |  /// Right eye has CO and cannot see PVA  3/60 and is PL+; left eye is 7-13 and cannot see PVA  3/60
	   (  inlist(causele, 5,6) & inlist(pvale, 5,6) & inlist(causere,7,8,9,10,11,12,13)  & inlist(pvare, 5,6,7)  )   |  /// Left eye has CO and is PL+ and cannot see PVA 3/60 and; Right eye is 7-13 and cannot see PVA  3/60
	   (  inlist(causere, 5,6) & inlist(causele, 5,6) & inlist(pvare, 5,6,7)  & inlist(pvale, 5,6,7) &   (inlist(pvale,1,2,3,4,5,6) | inlist(pvare,1,2,3,4,5,6))  )	/// Both eyes have CO and both eye cannot see PVA  3/60 and one eye is PL+
	 )
tab coVi360prevSurg		

label var  		coVi612prevSurg "Surgically amenable VI or blindness  due to CO" 
label define  coVi612prevSurg        0    "Not Surgically amenable VIB  due to CO" 1 "Surgically amenable VI or blindness  due to CO"
label value   coVi612prevSurg     coVi612prevSurg
	
label var  coVi618prevSurg "Surgically amenable MSVI or blindness  due to CO" 		
label define  coVi618prevSurg        0    "Not Surgically amenable MSVI due to CO" 1 "Surgically amenable MSVI or blindness due to CO"
label value   coVi618prevSurg     coVi618prevSurg

label var  coVi660prevSurg "Surgically amenable SVI or blindness due to CO" 					
			
label define  coVi660prevSurg        0    "Not Surgically amenable SVIB due to CO" 1 "Surgically amenable SVI or blindness due to CO"
label value   coVi660prevSurg     coVi660prevSurg

label var  coVi360prevSurg "Surgically amenable  blindness due to CO" 				
label define  coVi360prevSurg        0    "Not Surgically amenable blindness due to CO" 1 "Surgically amenable blindness due to CO"
label value   coVi360prevSurg     coVi360prevSurg
				

************************************************************************ 
** SO far, the starting point has been person having PVA < 6/12 and identifying how many had CO in one or both eyes
*** The next set of variables identify 
*** those persons in whom CO is marked as the cause of PVA < 6/12 in one, two eyes  
****** among persons who are ABOVE specified threshold of PVA in better eye 

** Therefore, now we identify persons with NO VI at person level but having one or both eye VI and CO in that eye

* D1. PVA Better than 6/12 
cap drop coNoVi612
gen     coNoVi612 = 0
// replace coNoVi612 = 2 if ///
// 		inlist(pvaBetter,1) &  /// PVA better eye - Can see  6/12
// 		(inlist(causere,5,6)  &  inlist(causele,5,6) ) & /// Both eyes have CAO as cause of PVA < 6/12 - will be ZERO always as cuase is not marked iv PVA is can see 6/12
// 		coNoVi612==0 
replace coNoVi612 = 1 if ///
		inlist(pvaBetter,1) & ///
		(inlist(causere,5,6)  |  inlist(causele,5,6) ) & /// Any One eye cause of PVA < 6/12 is CO 
		coNoVi612==0
label var coNoVi612 "CO in any eye but NO VI in person" 
label define coNoVi612 0 "No CO" 1 "U/L CO with no VI" 2 "B/L CO with no VI", replace
label value coNoVi612 coNoVi612
tab coNoVi612


* D2. PVA Better than 6/18 
tab pvaBetter coVi618
cap drop coNoVi618
gen     coNoVi618 = 0
// replace coNoVi618 = 2 if ///    
// 		inlist(pvaBetter,1,2) &  /// PVA better eye - Can see 6/18
// 		(inlist(causere,5,6)  &  inlist(causele,5,6) & inlist(pvare, 3,4,5,6,7)   & inlist(pvale, 3,4,5,6,7)   ) & /// Both eyes have CO as cause of PVA < 6/18  - will be ZERO
// 		coNoVi618==0 
replace coNoVi618 = 1 if ///
		inlist(pvaBetter,1,2) & ///  PVA better eye - Can see 6/18
		(  ///
			( inlist(causere,5,6) & inlist(pvare, 3,4,5,6,7) ) |  /// Right eye has CO as cause of PVA <6/12 
			( inlist(causele,5,6) & inlist(pvale, 3,4,5,6,7) )    /// Left  eye has CO as cause of PVA <6/12 
		)    &  /// 
		coNoVi618==0 //
		
label var coNoVi618 "CO in any eye but NO MSVIB in person" 
label define coNoVi618 0 "No CO" 1 "U/L CO with no MSVIB" 2 "B/L CO with no MSVIB", replace
label value coNoVi618 coNoVi618
tab   pvaBetter coNoVi618
tab   pvaBetter coNoVi612


* D3. PVA Better than 6/60 
tab pvaBetter coVi660
cap drop coNoVi660
gen     coNoVi660 = 0
// replace coNoVi660 = 2 if ///
// 		inlist(pvaBetter,1,2,3) &  /// PVA better eye - Can see 6/60
// 		(inlist(causere,5,6)  &  inlist(causele,5,6) & inlist(pvare, 4,5,6,7)   & inlist(pvale, 4,5,6,7)  ) & /// Both eye has CO as cause of PVA < 6/60 - will be ZERO
// 		coNoVi660==0 
replace coNoVi660 = 1 if ///
		inlist(pvaBetter,1,2,3) & /// PVA better eye - Can see 6/60
		(  ///
			( inlist(causere,5,6) & inlist(pvare, 4,5,6,7) ) |  /// Right eye has CO as cause of PVA <6/60  
			( inlist(causele,5,6) & inlist(pvale, 4,5,6,7) )    /// Left  eye has CO as cause of PVA <6/60
		)    &  /// 
		coNoVi660==0 //
		
label var coNoVi660 "CO in any eye but NO SVIB in person" 
label define coNoVi660 0 "No CO" 1 "U/L CO with no SVIB" 2 "B/L CO with no SVIB", replace
label value coNoVi660 coNoVi660



* D4. PVA Better than 3/60 
tab pvaBetter coVi360
cap drop coNoVi360
gen     coNoVi360 = 0
// replace coNoVi360 = 2 if ///
// 		inlist(pvaBetter,1,2,3,4) &  ///  PVA better eye - Can see 3/60
// 		(inlist(causere,5,6)  &  inlist(causele,5,6) & inlist(pvare, 5,6,7)   & inlist(pvale, 5,6,7)  ) & /// Both eye has CO as cause of PVA < 3/60 - will be ZERO
// 		coNoVi360==0 
replace coNoVi360 = 1 if ///
		inlist(pvaBetter,1,2,3,4) & /// PVA better eye - Can see  3/60
		(  ///
			( inlist(causere,5,6) & inlist(pvare, 5,6,7) ) |  /// Right eye has CO as cause of PVA <3/60 
			( inlist(causele,5,6) & inlist(pvale, 5,6,7) )    /// Left  eye has CO as cause of PVA <3/60 
		)    &  /// 
		coNoVi360==0 //
		
label var coNoVi360 "CO in any eye but NO Bl in person" 
label define coNoVi360 0 "No CO and NO Bl in person" 1 "U/L CO with no Bl" 2 "B/L CO with no Bl", replace
label value coNoVi360 coNoVi360

tab   pvaBetter coNoVi360
tab   pvaBetter coNoVi660
tab   pvaBetter coNoVi618
tab   pvaBetter coNoVi612
Code language: Stata (stata)

Related posts