Home » Topics » Domestic Violence » Difficulty reproducing DV prevalence results
Re: Difficulty reproducing DV prevalence results [message #739 is a reply to message #589] |
Thu, 05 September 2013 19:07 |
Liz-DHS
Messages: 1516 Registered: February 2013
|
Senior Member |
|
|
Dear User,
Hope this will help. Using CSPro here is some code and comments for the table you are trying to run. I am using code from our standard tables, so this may not match exactly but will give you an idea of how the application works. It may assist you in replicating the results. The variables used in our tables are working variables, but you can see where they actually come from.
Row Variables (separated by + signs)
V013W refers to V013 Age in 5-year groups
v130w refers to V130 Religion
v131w refers to V131 Ethnicity
v102w refers to V102 Type of place of residence
v101w refers to V101 Region
v501w2 refers to V501 Current marital status
v218w refers to V218 Number of living children
v741w3 refers to V741 Type of earnings from respondent's work
v106w refers to V106 Highest educational level
v190w refers to V190 Wealth index
tot1549 refers to a Total Variable for age 15-49
Column Variables (come after the row variables and separated from row variables by a blank)
coldv01a refers to a Column DV01 Variable and probably refers to the first two values in your table Ever, Oftencoldv01b refers to a Colulmn DV01 Variable and probably refers to the second set of values Sometimes, Any
numwom refers to the column with the number of women
If there was a * separator, that would indicate a layer
PROC GLOBAL
{+---------------------------------------------------------- ----------------------------------+}
{+ +}
{+ +}
{+ +}
{+ CHAPTER DV. Domestic Violence +}
{+ +}
{+ Table DVWT1: WORKING TABLE Background characteristics of respondents for the DV module +}
{+ Table DV.1 : Experience of physical violence +}
set explicit;
numeric i, imax, itot, j, jmax, jtot, imar, imar1, iepv, jepv, jany, jmax1, jmax2, iage, jphs;
numeric rweight;
numeric PVever, SVever, cnt;
numeric anyPV, anySV, AnyEV, freqPV, freqSV, freqEV, decision, wbeat, diffage, diffed;
numeric chusb, fhusb;
numeric d105aw, d105bw, d105jw, d105cw, d105dw, d105ew, d105fw, d105hw, d105iw, d105kw, d103aw, d103bw, d103cw;
crosstab float(0) txxx unweight runday+runmonth+runyear
exclude(specval, rowzero, colzero, totals, percents)
title( "Tables for Domestic Violence, Country 2011" );
crosstab float(1) dvwt1 v013w+v130w+v131w+v501w2+v741w3+v102w+v101w+v106w+v190w+tot1 549 imarr*coldvwt1
exclude(rowzero,colzero,percents,totals,specval)
title( "WORKING TABLE Background characteristics of respondents for the DV module"," ",
"Percent distribution of women who completed the domestic violence module by selected background",
"characteristics, Country 2011" )
stub( "Background characteristic" );
crosstab float(1) DV01 v013w11+v130w+v131w+v102w+v101w+v501w2+v218w+v741w3+v106w+v1 90w+tot1549 coldv01a+coldv01b+numwom
exclude(totals,specval,rowzero,colzero,percents)
{+US}
title( "Table DV.1 Experience of physical violence","",
"Percentage of women age 15-49 who have ever experienced physical violence since age 15 and",
"percentage who have experienced violence during the 12 months preceding the survey, by ",
"background characteristics, Country 2011" )
stub( "Background characteristic" );
PROC RECODE6_FF
preproc
numwom = 1;
numwom2 = 1;
numwom3 = 1;
ncurrm = 1;
emwoman = 1;
phsviol = 1;
twviol = 1;
total = 0;
tot1549 = 0;
unweight = ( sysparm()[1:1] = "U" ); { 1 - run unweighted tables }
postproc
{ constructs table to determine whether run is weighted/unweighted }
txxx(unweight,0) = sysdate( "dd" ); { day }
txxx(unweight,1) = sysdate( "mm" ); { month }
txxx(unweight,2) = sysdate( "yyyy" ); { year }
{ Table DVWT1 processing }
itot = tblrow( dvwt1 );
jmax1 = tblcol( dvwt1, imarr = 1 coldvwt1 = 1 );
jmax2 = tblcol( dvwt1, imarr = 2 coldvwt1 = 1 );
do i = 0 while i <= itot
dvwt1[i,jmax1] = dvwt1[i,jmax1+1] * 100 / dvwt1[itot,jmax1+1];
dvwt1[i,jmax2] = dvwt1[i,jmax2+1] * 100 / dvwt1[itot,jmax2+1];
enddo;
{ Table DV.1 processing }
jtot = tblcol( DV01 );
jmax = jtot - 1;
do j = 0 while j <= jmax
DV01[*,j] = DV01[*,j] * 100 / DV01[*,jtot];
enddo;
{ check unweighted N's }
Col2Dim( "dv01", dv01, 0, jtot-1, dv01u, 0 );
|
|
|
Goto Forum:
Current Time: Tue Nov 26 09:41:47 Coordinated Universal Time 2024
|