I have string variables e.g assets1-assets30 and i wanted to concat and seperate them by comma.
I have used this : egen x= concat(assets*), punct(",") but the resulting results has even commas from the variables with missing data.
Is there a way to return a concatenated variables only for the places where the variable is not missing.
Here is the sample data:
I have used this : egen x= concat(assets*), punct(",") but the resulting results has even commas from the variables with missing data.
Is there a way to return a concatenated variables only for the places where the variable is not missing.
Here is the sample data:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str40(assets15_20 assets16_21 assets17_22 assets18_23) "Bicycle" "Solar Panel" "Radio,Tape or CD player" "Television" "Radio,Tape or CD player" "Television" "Other Agricultural machines or tools" "" "Mosquito net" "Other Agricultural machines or tools" "" "" "Bicycle" "Radio,Tape or CD player" "Television" "Mosquito net" "" "" "" "" end
Comment