全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
12699 9
2017-05-01
为什么stata中有的变量把中文名字改成英文名字正常,有的却显示invalid name?
比如 变量“_社区(居委会)”可以改成英文,但是“邮政编码”就不可以
貌似和变量前面带不带下划线有关系
二维码

扫码加我 拉你入群

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

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

全部回复
2017-5-2 10:18:24
请把指令与错误讯息完整写出来,以供判断!
二维码

扫码加我 拉你入群

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

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

2017-5-2 12:02:30
第一个字符 不能是汉字, 所以后续许多操作无法进行。检验还是先在excel里面改成字母,然后在在stata中运行

看stata中的命名规则
Title

    varname (from [U] 11.4 varlists)


Description

    A varname is one variable name, such as

        x
        myvar
        Myvar
        inc92
        ausl渀搀椀猀挀栀
        reciprocal_of_miles_per_gallon
        _odd
        _1994

    When we use the term varname, we usually mean an existing varname -- a variable that
    already exists in the dataset.  The alternative would be a newvar.

    When referring to an existing varname, we can abbreviate -- use only some of the leading
    characters -- as long as we specify enough to uniquely identify the variable:

        Myv might be a unique abbreviation for Myvar.

        reciprocal might be a unique abbreviation for reciprocal_of_miles_per_gallon.

    Sometimes we can use the full varlist notation, but it must identify one variable:

        my*r might uniquely identify myvar

        r*gallon might uniquely identify reciprocal_of_miles_per_gallon.

    In the varlist notation, * means that zero or more characters go here.

    Varnames are often specified inside options, and then sometimes the varlist notation is
    allowed and sometimes it is not.  Abbreviations are always allowed, however, assuming
    that you have not turned them off; see set varabbrev.

    Note that variable names may be 1 to 32 Unicode characters long and must start with a
    Unicode letter or _, and the remaining characters may be Unicode letters, _, or Unicode
    number digits.  Examples of Unicode letters are "a", "Z", and "é"; examples of Unicode
    digits are 0, 1, and 9.

    The formal definition of a Unicode letter is a Unicode character for which uisletter()
    returns 1.  A Unicode digit is a Unicode character for which uisdigit() returns 1.

    An invalid UTF-8 sequence is allowed in the variable name and is counted as one
    character.  This is mainly for backward compatibility reasons.  For example, capital
    letter "E" with a grave accent is encoded as char(200) in ISO-Latin-1 encoding, which
    may appear in variable names of older versions of Stata, but char(200) alone is an
    invalid UTF-8 sequence.  See [U] 12.4.2.6 Advice for users of Stata before version 14
    for details.



二维码

扫码加我 拉你入群

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

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

2017-6-19 09:51:23
解决了吗?我也遇到同样的问题了
二维码

扫码加我 拉你入群

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

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

2017-6-19 09:59:59
jianggenghua 发表于 2017-6-19 09:51
解决了吗?我也遇到同样的问题了
我用的 Stata 14.2,是可以 rename 的!
复制代码
结果为
复制代码
二维码

扫码加我 拉你入群

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

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

2017-6-19 21:27:12
黃河泉 发表于 2017-6-19 09:59
我用的 Stata 14.2,是可以 rename 的!结果为
请问state13有方法解决吗
二维码

扫码加我 拉你入群

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

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

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

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