以单元格中的数据内容作为输出的表

时间:2015-09-09 07:16:03

标签: dataset output stata

我有一个数据集,并希望创建一个创建表的dofile,同时考虑我想要突出显示的数据集的某些方面。

我不需要任何汇总统计信息或频率,而是数据内容本身存在于我的表格中。

* some example data
input ///
str4 a b str11 reptiles
"234" 234 "alligator"
"2135" 2135 "lizard"
"324" 324 "snake"
"122" 122 "croc"
"23w4" 234 "alligator"
"21w35" 2135 "lizard"
"32w4" 324 "snake"
"1212" 122 "croc"
"234" 234 "all3igator"
"21135" 2135 "li3zard"
"3214" 324 "sn33ake"
"1232" 122 "cr3oc"
"2334" 234 "alli3gator"
"21235" 2135 "li3zard"
"3234" 324 "sna3ke"
"1232" 122 "cr3oc"

end

说我想创建一个像

这样的表
table a b if a=="234" & reptile=="all3igator"

我得到的格式正确,但没有数据集的实际内容(我得到一个频率)

目标是在我的do文件中定义我的表。让它运行并能够在每隔一段时间添加新数据后快速扫描输出以查找数据中的任何有趣变化。

1 个答案:

答案 0 :(得分:0)

与其他人一样,我仍然不清楚这里究竟需要什么,这是消极的而不是积极的。这个例子很清楚但不是特别有启发性:正如@Brendan Cox指出的那样,它似乎意味着只使用list。但groups(SSC)可能有所帮助,例如......

. groups a b reptiles

  +--------------------------------------------+
  |    a      b     reptiles   Freq.   Percent |
  |--------------------------------------------|
  | 1212    122         croc       1      6.25 |
  |  122    122         croc       1      6.25 |
  | 1232    122        cr3oc       2     12.50 |
  | 2113   2135      li3zard       1      6.25 |
  | 2123   2135      li3zard       1      6.25 |
  |--------------------------------------------|
  | 2135   2135       lizard       1      6.25 |
  | 21w3   2135       lizard       1      6.25 |
  | 2334    234   alli3gator       1      6.25 |
  |  234    234   all3igator       1      6.25 |
  |  234    234    alligator       1      6.25 |
  |--------------------------------------------|
  | 23w4    234    alligator       1      6.25 |
  | 3214    324      sn33ake       1      6.25 |
  | 3234    324       sna3ke       1      6.25 |
  |  324    324        snake       1      6.25 |
  | 32w4    324        snake       1      6.25 |
  +--------------------------------------------+