Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个数据集,我用命令将其导出outsheet到 csv 文件中。有一些行在某个地方断线。使用十六进制编辑器,我可以识别记录中换行符“0a”的控制字符。产生换行符的变量值在视觉上(在 Stata 中)仅显示 5 个字符。但是,如果我计算字符数:
outsheet
gen xlen = length(x)
我得到 6。我可以编写一个 Perl 程序来解决这个问题,但我更喜欢在导出之前删除 Stata 中的控制字符(例如使用regexr())。有谁知道如何删除控制字符?
regexr()
The char() function calls up particular ASCII characters. So, you can delete such characters by replacing them with empty strings.
char()
replace x = subinstr(x, char(10), "", .)