if V015 <> 1 then skip case endif;
{ load HIV testing data for woman }
testdatid = concat( edit("ZZZZZZZ9",V001), edit("ZZZ9",V002), edit("ZZ9",V003) );
samptake = loadcase( HIVTESTDAT, testdatid );
{ exclude if no test data found or if test was indeterminant }
If not samptake or not HIV03 in 0:7,9 then
skip case;
endif;
rweight = HIV05 / 1000000;
{ woman's age }
hivage = V013;
xtab( t1403, rweight );
{ tabulate all tables for men }
isex = 2;
for i in RECHMA_EDT do
{ if blood taken check if test was successful }
samptake = 0;
if HB63 = 1 then
{ load test data for men and modify hivres1 accordingly }
xline = edit("ZZ9",HB0);
testdatid = concat( edit("ZZZZZZZ9",HV001), edit("ZZZ9",HV002), edit("ZZ9",HB0) ); { Guillermo }
samptake = loadcase( HIVTESTDAT, testdatid );
if samptake then
if not HIV03 in 0:7,9 then
hivres1 = 4; { test was performed but protocol didn't reach the end }
samptake = 0; { not enough blood will not be included in the denominator }
endif;
else
hivres1 = 4; { blood taken but sample not on data file }
endif;
endif;
if HV103(HB0) = 1 then { de-facto population }
{ load male questionnaire }
maleid = concat( HHID, edit("ZZ9",HB0) );
if loadcase( MRECODE7, maleid ) & MV015 = 1 then
{ age in five years }
hivage = MV013;
{ exclude if no test data found or if test was indeterminate }
if samptake then
rweight = HIV05 / 1000000; { in HIV file }
xtab( t1403, rweight );
endif;
endif;
enddo;