Dear All,
I am using data (example file) recorded by software that has a convention to enclose in double quotes the content that itself contains any double quotes, and doubling those double quotes.
I find that the data can be imported correctly with the import delimited command, but not insheet command.
1. I'd like to maintain my code compatibility with earlier versions of Stata, before the introduction of the import delimited command, but I don't find any option that could affect the treatment of the quotes in the input file by insheet. I'd like to avoid parsing individual lines/quotes myself, of course, which is always a last resort possibility.
2. Is there any documentation on the specifics of the insheet's behavior for such cases? Like what exactly to expect and what not to expect from it? (presence of quotes, unmatched quotes, special characters, and other 'corner cases')?
Thank you, Sergiy Radyakin
I am using data (example file) recorded by software that has a convention to enclose in double quotes the content that itself contains any double quotes, and doubling those double quotes.
I find that the data can be imported correctly with the import delimited command, but not insheet command.
Code:
local fn "http://www.radyakin.org/statalist/2022/pdsample.txt" import delimited "`fn'", varnames(1) clear list insheet using "`fn'", tab case names clear list
2. Is there any documentation on the specifics of the insheet's behavior for such cases? Like what exactly to expect and what not to expect from it? (presence of quotes, unmatched quotes, special characters, and other 'corner cases')?
Thank you, Sergiy Radyakin
Code:
. local fn "http://www.radyakin.org/statalist/2022/pdsample.txt" . import delimited "`fn'", varnames(1) clear (encoding automatically selected: ISO-8859-1) (1 var, 1 obs) . list +----------------------------------------------------------------+ | comment | |----------------------------------------------------------------| 1. | school_categories||"some comment (from the user), goes here"|| | +----------------------------------------------------------------+ . . insheet using "`fn'", tab case names clear (1 var, 1 obs) . list +---------+ | comment | |---------| 1. | || | +---------+
Comment