全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
5864 3
2016-08-04
比如我想将变量abc大于100的值,都替换为100,其中500,600之间是有2个数值是缺失的
abc

1

2

3

4

500

600

120

10

11

12

13

14

15

在输入命令:replace abc = 100 if abc >= 100 后,结果发现“空值”也被赋值为100,不想对空值进行任何操作,该怎么处理呢?
运行结果:

. replace abc = 100 if abc >= 100
(5 real changes made)


abc
1
2
3
4
100
100
100
100
100
10
11
12
13
14
15




二维码

扫码加我 拉你入群

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

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

全部回复
2016-8-4 17:25:25
看帮助解释缺失值

Title

    [U] 12.2.1 Missing values

Description
    Stata has 27 numeric missing values:
        ., the default, which is called the "system missing value" or sysmiss
    and
        .a, .b, .c, ..., .z, which are called the "extended missing values".

    Numeric missing values are represented by large positive values.  The
    ordering is

                 all nonmissing numbers < . < .a < .b < ... < .z

    Thus, the expression age > 60 is true if variable age is greater than 60 or missing.

    To exclude missing values, ask whether the value is less than ".".  For instance,

        . list if age > 60 & age < .

    To specify missing values, ask whether the value is greater than or equal to
    ".".  For instance,
        . list if age >=.
    Stata has one string missing value, which is denoted by "" (blank).


二维码

扫码加我 拉你入群

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

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

2016-8-4 17:28:53
replace abc = 100 if abc >= 100  & abc~=.
二维码

扫码加我 拉你入群

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

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

2016-8-4 19:38:46
蓝色 发表于 2016-8-4 17:28
replace abc = 100 if abc >= 100  & abc~=.
非常感谢
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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