Dear all,
I would like to split string variables for instance if the original variable has an observation such as "p2.1, p3.1 and p4.1", I would like to split it in such a way that three variables are generated
with values (2.1, 3.1 and 4.1) and should be numeric.
Please find sample dataset that I am working on below
Thanks in Advance
I would like to split string variables for instance if the original variable has an observation such as "p2.1, p3.1 and p4.1", I would like to split it in such a way that three variables are generated
with values (2.1, 3.1 and 4.1) and should be numeric.
Please find sample dataset that I am working on below
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str20(m10_10_4_livefences m10_10_4_terracing m10_10_4_mintillage m10_10_4_farmmanure) "" "P2.1,P3.1,P4.1" "" "" "" "P2.1" "" "" "" "P2.1" "" "" "" "P2.1,P3.1" "" "" "" "P2.1,P3.1" "" "" "" "P1.2,P2.1" "P3.1" "" "" "P2.1,P3.1" "P4.1" "" "" "P3.1,P4.1" "" "" "" "P2.1,P3.1,P4.1" "" "" "" "" "" "" "P1.1" "" "" "" end
Thanks in Advance
Comment