I imported a dataset from Excel, but the string variables are being recognized as "different" when they should be the same. For example, below there should only be one category for "In Force". As of now, all of my variables are strings, and this is a problem for all of them.
How do I help Stata recognize that the text is "the same?" You can see in the second screenshot that they even appear "crooked" in browse, but e.g.
Code:
format Status %-14s
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str14 Model str16 EGA_In_Effect str29 Status "Model 1" "6/30/2014" "In Force " "Model 1" "11/30/2014" "In Force " "Model 1" "6/30/2014" "In Force " "Model 1" "6/30/2014" "In Force " "Model 2" "6/30/2014" "In Force " "Model 1" "6/30/2014" "In Force " "Model 2" "6/30/2014" "In Force " "Model 1" "6/30/2014" "In Force " "Model 1 " "6/30/2014" "In Force " "Model 1" "6/30/2014" "In Force " "Model 1 " "6/30/2014" "In Force " "Model 1" "6/30/2014" "In Force " "Model 1 " "6/30/2014" "In Force " "Model 2" "6/30/2014" "In Force " "Model 1" "6/30/2014" "In Force " "Model 1" "6/30/2014" "In Force " "Model 1" "6/30/2014" "In Force " "Model 1" "6/30/2014" "Signed " "Model 1" "11/30/2014" "In Force " "Model 1" "6/30/2014" "In Force " "Model 1" "6/30/2014" "In Force " "Model 2" "6/30/2014" "Signed" "Model 1" "6/30/2014" "Agreement in Substance" "Model 1" "6/30/2014" "In Force " end
Array
Thank you in advance!
Edit 1: Related post potentially: https://www.statalist.org/forums/for...-string-values
Edit 2: I tried
Code:
local varlist status status_date ega_in_effect model related_agreement1 related_agreement_2 correction_1 correction_2 superseding_model_1 understanding_1 foreach v of varlist `varlist'{ replace `v' = subinstr(`v', " ", "", ., ?) }
0 Response to Formatting Strings: same words being recognized as "different"
Post a Comment