选择观测数据块上的最小值 [英] Select the minimum over blocks of observations

查看:11
本文介绍了选择观测数据块上的最小值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让Stata选择每个人吃的ice_cream的最小值(AmandaChristianPaola),这样我最终只有3行:

person  ice_cream
    Amanda  16
    Amanda  27
    Amanda  29
    Amanda  40
    Amanda  96
    Amanda  97
    Christian   19
    Christian   23
    Christian   26
    Christian   27
    Christian   28
    Christian   34
    Christian   62
    Christian   70
    Christian   78
    Paola   5
    Paola   11
    Paola   28
    Paola   97

推荐答案

避免创建新变量的答案:

sort person ice_cream
by person: keep if _n == 1

这篇关于选择观测数据块上的最小值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆