I have a panel data set with a variable that measures how many children women have. I would like to create a categorical variable that indicates whether women went from 0 children to atleast 1 child, from 1 child to 2, from 3 to 4, from 4 to 5 etc. measured from one wave to the next (2012-2018).
Panel ID = Findid
Year = round
Children variable = child_w
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input double Findid int round float child_w 601004004 2012 2 601004004 2018 3 601004603 2012 3 601004603 2018 3 601005902 2012 2 601005902 2018 2 601012406 2012 2 601012406 2018 2 601020204 2012 0 601020204 2018 1 601029206 2012 2 601029206 2018 2 601032102 2012 0 601032102 2018 0 601032309 2012 3 601032309 2018 4 601037505 2012 2 601037505 2018 3 601038302 2012 0 601038302 2018 0 601045003 2012 1 601045003 2018 2 601050804 2012 2 601050804 2018 3 601051404 2012 3 601051404 2018 4 601054402 2012 2 601054402 2018 3 601055607 2012 0 601055607 2018 0 601056302 2012 2 601056302 2018 3 601058302 2012 2 601058302 2018 3 601058602 2012 3 601058602 2018 3 601060002 2012 3 601060002 2018 4 601060202 2012 2 601060202 2018 2 601060302 2012 2 601060302 2018 2 601061602 2012 0 601061602 2018 2 601062002 2012 3 601062002 2018 3 601062602 2012 3 601062602 2018 4 601063102 2012 2 601063102 2018 3 601067002 2012 2 601067002 2018 2 601072002 2012 4 601072002 2018 4 601072702 2012 1 601072702 2018 2 601072902 2012 2 601072902 2018 2 601073102 2012 2 601073102 2018 2 601074502 2012 2 601074502 2018 2 601075902 2012 2 601075902 2018 3 601077402 2012 4 601077402 2018 5 601078802 2012 3 601078802 2018 3 601080302 2012 3 601080302 2018 3 601082202 2012 2 601082202 2018 2 601083402 2012 3 601083402 2018 3 601085202 2012 2 601085202 2018 3 601085602 2012 3 601085602 2018 3 601085703 2012 2 601085703 2018 4 601086402 2012 2 601086402 2018 4 601088002 2012 2 601088002 2018 2 601088202 2012 3 601088202 2018 3 601088305 2012 0 601088305 2018 0 601088306 2012 2 601088306 2018 3 601089002 2012 2 601089002 2018 3 601089303 2012 2 601089303 2018 2 601090502 2012 3 601090502 2018 3 601090602 2012 3 601090602 2018 3 601091602 2012 3 601091602 2018 2 end label values round code
0 Response to Creating categorical variable
Post a Comment