I am relatively new to Stata, and I am stuck on a hopefully easy-to-solve issue.
In my dataset individuals are uniquely identified by hhid and id. I am interested in whether these individuals, a) have a savings account and b) if so, they have a mobile money savings account.
My current data looks like the following, where
savingsacc==1 -> commercial savings account,
savingsacc==4 -> mobile money savings account
savingsacc==0 -> no savings account
Code:
hhid id savingsacc mobmoney 1 4 1 . 1 4 4 1 1 10 0 . 3 1 1 . 3 2 1 . 3 2 4 1
In order to merge this with another dataset using hhid id, I need the data to look like the following, with savingsacc and mobmoney converted into simple yes/no dummies.
Code:
hhid id savingsacc mobmoney 1 4 1 1 1 10 0 0 3 1 1 0 3 2 1 1
Thank you in advance for your help!
Best,
Sophia
0 Response to Simple data transformation
Post a Comment