Short version: -import delimited- appears not to work well with delimiters above char(127), but that's not documented.
While testing out my suggested answer for a previous posting here I had suggested using an unusual character (ASCII 171) as a delimiter for a file to be read with -import delimited- because a character like that would not likely appear in ordinary text. At least in my older version of Stata (15.1), -import delimited- will not parse variable values if the delimiter is a character whose ASCII code is above 127. While such a delimiter is of course a strange thing, there are times when using something like that might be useful, and I can't find any documentation of this as something not allowed. This behavior might be different in a newer version of Stata, but here's an example on which I'd like to get some feedback from someone running a newer version before I send this on to Stata tech support:
While testing out my suggested answer for a previous posting here I had suggested using an unusual character (ASCII 171) as a delimiter for a file to be read with -import delimited- because a character like that would not likely appear in ordinary text. At least in my older version of Stata (15.1), -import delimited- will not parse variable values if the delimiter is a character whose ASCII code is above 127. While such a delimiter is of course a strange thing, there are times when using something like that might be useful, and I can't find any documentation of this as something not allowed. This behavior might be different in a newer version of Stata, but here's an example on which I'd like to get some feedback from someone running a newer version before I send this on to Stata tech support:
Code:
// Create a test file with an upper ASCII custom delimiter local delimiter = char(171) sysuse auto, clear tempfile temp export delimited using "`temp'", delimiter("`delimiter'") nolabel datafmt quote replace // File looks ok although the delimiter isn't printable. type "`temp'" // // Import this file and see if Stata parses it properly. clear import delimited using "`temp'", delimiter("`delimiter'") browse
Comment