全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
12156 3
2015-10-17
有两期数据,部分为追访,部分为新数据,想要筛选出追访的数据,用ID,但1期的ID是str10而2期的ID是str12,想问怎么才能将2期的追访数据用ID匹配到1期的,谢谢大家, 着急
二维码

扫码加我 拉你入群

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

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

全部回复
2015-10-17 16:27:53

Title

    [D] recast -- Change storage type of variable


Syntax

        recast type varlist [, force]

    where type is byte, int, long, float, double, str1, str2, ..., str2045, or strL.


Description

    recast changes the storage type of the variables identified in varlist to type.


Options

    force makes recast unsafe by causing the variables to be given the new storage type even if that will cause
        a loss of precision, introduction of missing values, or, for a string variables, the truncation of
        strings.

        force should be used with caution.  force is for those instances where you have a variable saved as a
        double but would now be satisfied to have the variable stored as a float, even though that would lead
        to a slight rounding of its values.


Examples

    Setup
        . sysuse auto

    Describe the variable mpg
        . describe mpg

    Change the storage type of mpg from int to byte
        . recast byte mpg

    Describe the variable mpg
        . describe mpg

    Describe the variable headroom
        . describe headroom

    Try to change the storage type of headroom from float to int
        . recast int headroom

    Describe the variable headroom
        . describe headroom

    Describe the variable make
        . describe make

    Try to change the storage type of make from str18 to str16
        . recast str16 make

    Change the storage type of make from str18 to str20
        . recast str20 make

    Describe the variable make
        . describe make
二维码

扫码加我 拉你入群

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

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

2015-10-17 22:21:49
蓝色 发表于 2015-10-17 16:27
Title

    [D] recast -- Change storage type of variable
太感谢了!!手册直接上,已经解决。
二维码

扫码加我 拉你入群

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

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

2020-3-17 01:28:30
请问我将str150 用recast压缩至str100,有100个值改变了,怎么才能知道是哪些值改变了呢(样本很大),谢谢指教
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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