Hi guys
I kindly ask for your help , I'm trying to reshape this database. I want to organize the follow-up dates for food consumption and nutritional status consultations (variables "dataacomp_ca" and "dataacomp_en). Notice that I have 12 different dates for "dataacomp_ca" and 2 different dates for "dataacomp_en". all this for the same “id”
I would like to transform the bank to wide to calculate the difference between dates and identify the smallest gap between them.
In addition, I want to point out that the information on food consumption and nutritional status may be different for each "dataacomp_ca" and "dataacomp_en" because it is a follow-up. In addition, in this database I find several possibilities of number of follow-up dates for dataacom_ca and dataacomp_en. Here I put an example of the same person (id) who has 12 food consumption follow-ups and 2 nutritional status follow-ups. But the settings may be different for other people
I would like this configuration:
Id dataacomp_ca1 dataacomp_ca2 dataacomp_ca3 dataacomp_ca4 dataacomp_ca5 dataacomp_ca6 dataacomp_ca7 dataacomp_ca8 dataacomp_ca9 dataacomp_ca10 dataacomp_ca11 dataacomp_ca12 dataacomp_en1 dataacomp_en2
thank you very much for the help
----------------------- copy starting from the next line -----------------------
------------------ copy up to and including the previous line ------------------
Listed 24 out of 24 observations
I kindly ask for your help , I'm trying to reshape this database. I want to organize the follow-up dates for food consumption and nutritional status consultations (variables "dataacomp_ca" and "dataacomp_en). Notice that I have 12 different dates for "dataacomp_ca" and 2 different dates for "dataacomp_en". all this for the same “id”
I would like to transform the bank to wide to calculate the difference between dates and identify the smallest gap between them.
In addition, I want to point out that the information on food consumption and nutritional status may be different for each "dataacomp_ca" and "dataacomp_en" because it is a follow-up. In addition, in this database I find several possibilities of number of follow-up dates for dataacom_ca and dataacomp_en. Here I put an example of the same person (id) who has 12 food consumption follow-ups and 2 nutritional status follow-ups. But the settings may be different for other people
I would like this configuration:
Id dataacomp_ca1 dataacomp_ca2 dataacomp_ca3 dataacomp_ca4 dataacomp_ca5 dataacomp_ca6 dataacomp_ca7 dataacomp_ca8 dataacomp_ca9 dataacomp_ca10 dataacomp_ca11 dataacomp_ca12 dataacomp_en1 dataacomp_en2
thank you very much for the help
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long id float(dataacomp_ca dataacomp_en) 76555256 21769 21651 76555256 21864 21651 76555256 21889 21651 76555256 21830 21651 76555256 21683 21651 76555256 21861 21651 76555256 21801 21651 76555256 21648 21651 76555256 21738 21651 76555256 21560 21651 76555256 21593 21651 76555256 21626 21651 76555256 21830 21770 76555256 21683 21770 76555256 21560 21770 76555256 21861 21770 76555256 21593 21770 76555256 21738 21770 76555256 21769 21770 76555256 21626 21770 76555256 21801 21770 76555256 21864 21770 76555256 21889 21770 76555256 21648 21770 end format %td dataacomp_ca format %td dataacomp_en
Listed 24 out of 24 observations

Comment