楼主: sarral123
5001 8

[数据管理求助] 如何在stata里配对父子母子关系 [推广有奖]

  • 1关注
  • 0粉丝

大专生

60%

还不是VIP/贵宾

-

威望
0
论坛币
3 个
通用积分
0.0005
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
3912 点
帖子
35
精华
0
在线时间
53 小时
注册时间
2015-7-14
最后登录
2017-1-28

楼主
sarral123 发表于 2015-8-11 16:55:18 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
各位大神们,有谁研究过CHNS数据,如何在stata里配对父子母子关系,这里的子女是18岁以上的,父母和子女都在同一个adult问卷里,但他们问卷的household id 是一样的;没研究过CHNS也没关系,跟我说下大体思路也可以,跪求了
二维码

扫码加我 拉你入群

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

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

关键词:Stata tata household CHNS数据 Adult 如何

沙发
andruw 在职认证  发表于 2015-8-11 16:58:01
  1. help joinby
复制代码
已有 1 人评分经验 热心指数 收起 理由
夏目贵志 + 5 + 1 热心帮助其他会员

总评分: 经验 + 5  热心指数 + 1   查看全部评分

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

板凳
andruw 在职认证  发表于 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)

已有 2 人评分经验 论坛币 学术水平 热心指数 信用等级 收起 理由
4290972296 + 5 + 1 + 1 + 1 精彩帖子
hustchen2012 + 20 + 20 精彩帖子

总评分: 经验 + 20  论坛币 + 25  学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

报纸
andruw 在职认证  发表于 2015-8-11 17:40:08
红色即是例子.

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

7
andruw 在职认证  发表于 2015-8-11 18:08:31
sarral123 发表于 2015-8-11 17:55
我按照这个操作了,就是简单的将两个合并到一起就行了么,要根据自己测量的指标将数据挑选出来组成一个自己 ...
恩。把自己的数据拿出来按例子跑一下就ok了。
祝顺利!

8
sarral123 发表于 2015-8-11 18:11:30
andruw 发表于 2015-8-11 18:08
恩。把自己的数据拿出来按例子跑一下就ok了。
祝顺利!
特别感谢你的帮助

9
Rrrr. 发表于 2024-4-21 11:45:39
请问你的问题解决了吗?我于到相同问题不知道怎么解决

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2025-12-29 08:58