hello everyone,
please I need help.
I have a data set with a variable finasset_ type (coded 1-5) under which five different financial asset types are repeatedly listed for every household member. respondents answered if they have each particular financial asset type under a variable 's5bq02' (coded 1 if yes and 2 if No) . how do I generate a binary variable that will indicate 1 if the respondent owns a financial asset and 0 if not, irrespective of the type of financial asset? I just want the variable to take 1 if respondents own any of the types of assets.
Here is the dataex
[CODE]
* Example generated by -dataex-. To install: ssc install dataex
clear
input str18 household_id double(individual_id asset_type) str15 ea_id double(saq14 pw_w4 saq01) str2(saq02 saq03) double(saq04 saq05) str3 saq06 str2 saq07 double(saq08 s5bq01) str19 s5bq01_os double s5bq02
"010101088800910007" 1 1 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910007" 1 2 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910007" 1 3 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910007" 1 4 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910007" 1 5 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910007" 2 1 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910007" 2 2 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910007" 2 3 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910007" 2 4 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910007" 2 5 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910007" 3 1 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910007" 3 2 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910007" 3 3 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910007" 3 4 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910007" 3 5 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910017" 1 1 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 17 2 "" .
"010101088800910017" 1 2 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 17 1 "" 1
"010101088800910017" 1 3 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 17 2 "" .
"010101088800910017" 1 4 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 17 2 "" .
"010101088800910017" 1 5 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 17 2 "" .
"010101088800910026" 1 1 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 26 2 "" .
"010101088800910026" 1 2 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 26 2 "" .
"010101088800910026" 1 3 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 26 2 "" .
"010101088800910026" 1 4 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 26 2 "" .
"010101088800910026" 1 5 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 26 2 "" .
"010101088800910026" 8 1 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 26 2 "" .
--more--
please I need help.
I have a data set with a variable finasset_ type (coded 1-5) under which five different financial asset types are repeatedly listed for every household member. respondents answered if they have each particular financial asset type under a variable 's5bq02' (coded 1 if yes and 2 if No) . how do I generate a binary variable that will indicate 1 if the respondent owns a financial asset and 0 if not, irrespective of the type of financial asset? I just want the variable to take 1 if respondents own any of the types of assets.
Here is the dataex
[CODE]
* Example generated by -dataex-. To install: ssc install dataex
clear
input str18 household_id double(individual_id asset_type) str15 ea_id double(saq14 pw_w4 saq01) str2(saq02 saq03) double(saq04 saq05) str3 saq06 str2 saq07 double(saq08 s5bq01) str19 s5bq01_os double s5bq02
"010101088800910007" 1 1 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910007" 1 2 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910007" 1 3 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910007" 1 4 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910007" 1 5 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910007" 2 1 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910007" 2 2 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910007" 2 3 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910007" 2 4 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910007" 2 5 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910007" 3 1 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910007" 3 2 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910007" 3 3 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910007" 3 4 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910007" 3 5 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 7 2 "" .
"010101088800910017" 1 1 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 17 2 "" .
"010101088800910017" 1 2 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 17 1 "" 1
"010101088800910017" 1 3 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 17 2 "" .
"010101088800910017" 1 4 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 17 2 "" .
"010101088800910017" 1 5 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 17 2 "" .
"010101088800910026" 1 1 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 26 2 "" .
"010101088800910026" 1 2 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 26 2 "" .
"010101088800910026" 1 3 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 26 2 "" .
"010101088800910026" 1 4 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 26 2 "" .
"010101088800910026" 1 5 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 26 2 "" .
"010101088800910026" 8 1 "010101088800910" 1 1658.475108571429 1 "01" "01" 8 88 "009" "10" 26 2 "" .
--more--
Comment