This post died in the forum about some days ago, so here's again.
I am having a problem with data cleaning (again, anyhow I feel I have improved in some areas). I am working on a panel data set, in long format with Stata 16.
This data set that I am working in, after the cleaning, I will merge the cleaned data set to the master data set.
As you can see in the data set that I am coding here using dataex :
help dataex
dataex mergeid ch002_1 ch002_2 ch002_3 ch002_4 ch002_5 ch002_6 ch002_7 in 1/10
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str12 mergeid byte(ch002_1 ch002_2 ch002_3 ch002_4 ch002_5 ch002_6 ch002_7) "AT-000674-01" . . . . . . . "AT-001215-01" . . . . . . . "AT-001492-01" . . . . . . . "AT-001492-02" . . . . . . . "AT-001881-01" . . . . . . . "AT-001881-02" . . . 5 5 . . "AT-002136-01" . . . . . . . "AT-002136-03" . . . . . . . "AT-002180-02" . . . . . . . "AT-002180-03" . . . . . . . end label values ch002_1 yesno label values ch002_2 yesno label values ch002_3 yesno label values ch002_4 yesno label values ch002_5 yesno label values ch002_6 yesno label values ch002_7 yesno label def yesno 5 "No", modify
Listed 10 out of 57811 observations
I have the variables ch002_ from 1 to 16, that represent the if the child is genetic or not. The options can list up to 16 children, which the majority of the respondents leave as missing. I need to get rid of those missing values (otherwise the data set will be strongly unbalanced) and at the same time, I am only interested in the total amount of genetic and non genetic children in general, my objective is not to differentiate whether the first or the 4th is natural and the 3rd is not, all I need is the X amount of genetic and Y amount of adopted, in connection to the mergeid variable (I don't want to lose track of the individuals).
I don't know how to code a solution for this.
Thank you for your time, hope you are having a nice May 1st in contrast to the World context.
P.S. I couldn't terminate my last Stata entry because I lost the link to it and was not able to find it again, anyhow, the responses helped and I thank you.
0 Response to Problem with data cleaning some variables
Post a Comment