stata15中文乱码处理——转自连玉君老师码云
1. ua 命令
适用于 stata15 用户。可以一次性对当前工作路径以及所有子文件夹中的文件进行转码(unicode),以保证中文字符可以正常显示。
安装
下载 ua.ado 和 ua.hlp,放置于 D:\stata15\ado\base\u 或 D:\stata15\ado\plus\u 文件夹中。
使用
- 在 Stata 命令窗口中输入
help ua,查看命令介绍和 Stata 范例。参照范例使用即可。
Stata 范例
* Change current working directory (CWD)
. cd D:\stata15\ado\personal\mypaper
* Unicode all .dta files in CWD and files in sub-directories
. ua: unicode encoding set gb18030
. ua: unicode translate *.dta
* Unicode all files (.do, .ado, .dta, .hlp, etc.) in CWD and files in sub-directories
. ua: unicode encoding set gb18030
. ua: unicode translate *
2. uall 命令
Description
uall is shortcut for help ua.
It executes the following two commands:
. ua: unicode encoding set gb18030
. ua: unicode translate *
Syntax
- Short version (Chinese only):
. uall
- Full version:
. uall [encoding-name]
- encoding-name is the name of encoding, see the list of encodings.
- The default is gb18030 for Chinese. So, for Chinese user, you need not specify this option.
Examples
* Change current working directory (CWD)
. cd D:\stata15\ado\personal\mypaper
* For Chinese users:
. uall
* For Japnese users:
. uall ibm-943_P15A-2003
* For Korean users:
. uall ibm-970_P110_P110-2006_U2
Author
- Yujun,Lian (Arlion) Department of Finance, Lingnan College, Sun Yat-Sen University.
- E-mail: arlionn@163.com.
- 连玉君 (知乎 | 简书 | 码云)

浙公网安备 33010602011771号