全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
4920 8
2015-08-11
各位大神们,有谁研究过CHNS数据,如何在stata里配对父子母子关系,这里的子女是18岁以上的,父母和子女都在同一个adult问卷里,但他们问卷的household id 是一样的;没研究过CHNS也没关系,跟我说下大体思路也可以,跪求了
二维码

扫码加我 拉你入群

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

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

全部回复
2015-8-11 16:58:01
复制代码
二维码

扫码加我 拉你入群

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

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

2015-8-11 17:09:09
andruw 发表于 2015-8-11 16:58
太感谢了,能具体点么,我是初学者,实在不好意思
二维码

扫码加我 拉你入群

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

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

2015-8-11 17:39:18

Title

    [D] joinby -- Form all pairwise combinations within groups


Syntax

        joinby [varlist] using filename [, options]

    options                Description
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Options
      When observations match:
      update               replace missing data in memory with values from filename
      replace              replace all data in memory with values from filename

      When observations do not match:
      unmatched(none)      ignore all; the default
      unmatched(both)      include from both datasets
      unmatched(master)    include from data in memory
      unmatched(using)     include from data in filename

      _merge(varname)      varname marks source of resulting observation; default is _merge
      nolabel              do not copy value-label definitions from filename
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    varlist may not contain strLs.


Menu

    Data > Combine datasets > Form all pairwise combinations within groups


Description

    joinby joins, within groups formed by varlist, observations of the dataset in memory with filename, a Stata-format dataset.  By join we mean to form all pairwise combinations.
    filename is required to be sorted by varlist.  If filename is specified without an extension, .dta is assumed.

    If varlist is not specified, joinby takes as varlist the set of variables common to the dataset in memory and in filename.

    Observations unique to one or the other dataset are ignored unless unmatched() specifies differently.  Whether you load one dataset and join the other or vice versa makes no
    difference in the number of resulting observations.

    If there are common variables between the two datasets, however, the combined dataset will contain the values from the master data for those observations.  This behavior can be
    modified with the update and replace options.


Options

        +---------+
    ----+ Options +------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    update varies the action that joinby takes when an observation is matched.  By default, values from the master data are retained when the same variables are found in both datasets.
        If update is specified, however, the values from the using dataset are retained where the master dataset contains missing.

    replace, allowed with update only, specifies that nonmissing values in the master dataset be replaced with corresponding values from the using dataset.  A nonmissing value, however,
        will never be replaced with a missing value.

    unmatched(none|both|master|using) specifies whether observations unique to one of the datasets are to be kept, with the variables from the other dataset set to missing.  Valid values
        are

            none    ignore all unmatched observations (default)
            both    include unmatched observations from the master and using data
            master  include unmatched observations from the master data
            using   include unmatched observations from the using data

    _merge(varname) specifies the name of the variable that will mark the source of the resulting observation.  The default name is _merge(_merge).  To preserve compatibility with earlier
        versions of joinby, _merge is generated only if unmatched is specified.

    nolabel prevents Stata from copying the value-label definitions from the dataset on disk into the dataset in memory.  Even if you do not specify this option, label definitions from
        the disk dataset do not replace label definitions already in memory.


Example

    Setup
        . webuse child
        . describe
        . list
        . webuse parent
        . describe
        . list, sep(0)
        . sort family_id

    Join information on parents from data in memory with information on children from data at http://www.stata-press.com
        . joinby family_id using http://www.stata-press.com/data/r13/child

    Describe the resulting dataset
        . describe

    List the resulting data
        . list, sepby(family_id) abbrev(12)

二维码

扫码加我 拉你入群

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

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

2015-8-11 17:40:08
红色即是例子.
二维码

扫码加我 拉你入群

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

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

2015-8-11 17:55:15
我按照这个操作了,就是简单的将两个合并到一起就行了么,要根据自己测量的指标将数据挑选出来组成一个自己建的数据就可以了么
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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