文章2021_01_05_stata15在mac上的dta编码问题和系统crash
stata15
macos 10.15.3
問題:無法unicode中文的dta數據,unicode invalid option時,出現系統crash
解決: 值標簽損壞導致的crash, 區分標簽和內容分別轉碼。
https://www.statalist.org/forums/forum/general-stata-discussion/general/1488060-stata-15-crashes-when-using-unicode-translate
We have two users reporting the similar issue. Both are caused by the original dataset contains corrupted value label(s). The dataset works fine when the particular value label(s) are not used. But when -unicode translate- or other Stata commands try to use the corrupted value label(s), it will potentially crash Stata.?
To work around it, you may do the following,?
?
Code:
// I use test.dta as an example// first we would like to save all value labels in test.dta to a do-file mylab.do use "test.dta", clear label save _all using mylab, replace// then we drop all value labels from the dataset, and save the new dataset as test2.dta label drop _all save test2.dta, replace// now we can translate test2.dta clear unicode encoding set gb18030 unicode translate "test2.dta", invalid(mark) transutf8// now we translate the mylab.do clear unicode encoding set gb18030 unicode translate mylab.do, invalid(ignore)// now we can re-attach value labels use "test2.dta", clear do mylab.doNow test2.dta contains translated dataset with fixed value labels, Please email Stata tech support at?tech-support@stata.com?with the dataset attached if the problem persists.
?
# 據稱,stata14后的數據采用了unicode編碼,所以除了上面的crash問題,還有低版本和高版本數據的轉化問題,如stata5-12和stata13,stata14及以上之間的轉化問題。
首先,分析一下文件編碼是必要的,如果確定原始文件的編碼是gb18030,可以set。
gb18030,gb2312,GBK。
cd ...
unicode analyze test.dta
unicode encodinng set gb18030
unicode translate test.dta
https://www.bilibili.com/video/BV1pa4y1j7eF/?spm_id_from=trigger_reload
?
未解決的問題:stata中的科學計數數值轉到r中時,會變成字符。
總結
以上是生活随笔為你收集整理的文章2021_01_05_stata15在mac上的dta编码问题和系统crash的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 设计模式面试题(总结最全面的面试题!!!
- 下一篇: 微智魔盒骗局_微智魔盒官宣