Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: limiting rows in tabulate


From   Richard Goldstein <[email protected]>
To   statalist <[email protected]>
Subject   st: limiting rows in tabulate
Date   Mon, 17 Aug 2009 12:09:47 -0400

Hi:

I am still using version 10.1

the row variable is a string variable

I have sent a client the results of a tabulate command based on a couple
of "if"'s

My client now wants me to drop one of the if's and do a new tab but
ensure that only the same rows (values) appear in the tab -- that is, if
a row was previously eliminated by the -if- that is now being dropped,
that row should still be eliminated

an example might make this clearer; say I do:

. ta rep78 if foreign==1 & price>10000

     Repair |
Record 1978 |      Freq.     Percent        Cum.
------------+-----------------------------------
          5 |          1      100.00      100.00
------------+-----------------------------------
      Total |          1      100.00
r; t=0.00 9:05:11

I now want to drop the foreign=1 condition but still have a table that
only shows the row for rep78=5

actually what is wanted now is a crosstab where the column variable was the old -if- condition, but the rows are limited; e.g.,
. ta rep78 foreign if price>10000

    Repair |
    Record |       Car type
      1978 |  Domestic    Foreign |     Total
-----------+----------------------+----------
         2 |         1          0 |         1
         3 |         7          0 |         7
         5 |         0          1 |         1
-----------+----------------------+----------
     Total |         8          1 |         9

but of course I would only want the row for "5"; in my actual data, the requested table would have more than 100 rows so I can't use a simple -if-

Rich

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index