全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
1345 4
2021-11-13
13版的数据用stata15打开,我在网上找了unicode translate * 还有unicode retranslate * https://www.freesion.com/article/9479336368/ 我试了这些命令,但还是乱码的很严重。然后,试图用笨办法把数据从13粘到15,结果发现复制粘贴会导致一小部分样本错位了,也不行。各位大神,有什么办法可以解决么?一直困扰了我好久,感谢回复!!


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2021-11-14 09:40:30
比如
. unicode analyze 2000.dta

  File summary (before starting):
        1  file(s) specified
        1  file(s) to be examined ...

  File 2000.dta (Stata dataset)
      105 variable names need translation
       72 variable labels need translation
       16 str# variables need translation
          -----------------------------------------------------------------------------------
          Some elements of the file appear to be UTF-8 already.  Sometimes elements that
          need translating can look like UTF-8.  Look at these example(s):
              variable name "_Ӫҵ״̬"
          Do they look okay to you?
          If not, the file needs translating or retranslating with the transutf8 option.
          Type
              . unicode   translate "2000.dta", transutf8
              . unicode retranslate "2000.dta", transutf8
          -----------------------------------------------------------------------------------
          File needs translation.  Use unicode translate on this file.

  File 2000.dta needs translation

  File summary:
        1 file(s) need translation

. unicode encoding set Windows-1252
  (default encoding now Windows-1252)

. unicode translate "2000.dta", invalid(mark) transutf8
  (using Windows-1252 encoding)

  File summary (before starting):
        1  file(s) specified
        1  file(s) to be examined ...

  File 2000.dta (Stata dataset)
      all variable names translated
      all data labels translated
      all variable labels translated
      all str# variables translated
          -----------------------------------------------------------------------------------
          File successfully translated

  File summary:
      all files successfully translated

.
end of do-file
虽然显示转换成功了,但是打开还是乱码
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2021-11-14 20:39:42
自己回答一下,网上unicode转码对我的数据不起作用,试了好久还是不行。后面我是这样做的:
把13版的数据直接用15打开(虽然是很严重的乱码);
然后,用15的stata中export出.csv格式,这样中文都可以正常显示了【这里需要注意有的原本一行观测值可能会分成几行了,还好我这只有个别是这样的,于是在csv里对照原始数据把异常的整理后形成各自的每一行】;
最后,再import,将csv导入stata15中,框中选择chinese(gbk),中文显示正常了。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2024-2-26 13:11:57
海阔天空锦鲤 发表于 2021-11-14 20:39
自己回答一下,网上unicode转码对我的数据不起作用,试了好久还是不行。后面我是这样做的:
把13版的数据直 ...
我用了您这个方法,但是显示 invalid '(' ,没法实现。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2024-2-27 16:18:46
shidakaia9 发表于 2024-2-26 13:11
我用了您这个方法,但是显示 invalid '(' ,没法实现。
不好意思时间长了,我不太清楚,没能帮到你
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群