I am trying to combine 10 string variables in one. I want space after each variable entry in the new variable. Some of these variables have no values.
When I use the Concat function, then there is no space between the resulting variable entries(see variable crop4). I also tried using catenate command (see variable crop_harvestmain); however, it leaves space for each variable where there is no value. So, if I have values in var 1 var3 var7, catenate gives me "1 3 7", concat gives me "137'; whereas I want "1 3 7" irrespective of which value is missing.
Please help.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str1(crop_harvest1 crop_harvest2 crop_harvest3) str18 crop_harvestmain str8 crop4 "1" "" "3" "1 3 4 5 6 7 " "134567" "" "" "3" " 3 4 6 " "346" "1" "" "3" "1 3 4 5 6 " "13456" "1" "" "" "1 4 5 6 7 " "14567" "1" "" "" "1 5 6 " "156" "1" "" "" "1 5 6 " "156" "1" "" "3" "1 3 4 5 6 7 " "134567" "1" "" "3" "1 3 5 6 7 " "13567" "1" "" "3" "1 3 5 6 7 " "13567" "1" "" "3" "1 3 6 " "136" "1" "" "3" "1 3 4 5 6 " "13456" "1" "" "3" "1 3 4 5 6 7 " "134567" "1" "" "3" "1 3 5 6 7 " "13567" "1" "" "3" "1 3 4 5 6 7 " "134567" "1" "" "3" "1 3 5 6 7 " "13567" "1" "" "3" "1 3 5 6 7 " "13567" "1" "2" "3" "1 2 3 5 6 7 " "123567" "1" "" "" "1 5 6 " "156" end
0 Response to Space in concat function
Post a Comment