Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: How to list all the observation meeting the conditions which are the former results?
From
Grace Jessie <[email protected]>
To
<[email protected]>
Subject
st: How to list all the observation meeting the conditions which are the former results?
Date
Sun, 12 Dec 2010 12:46:29 +0000
Dear statalists,
How to list all the observation meeting the conditions which are the former results?
For example,
. clear
. input x y z
x y z
1. 1 2 8
2. 1 2 2
3. 2 3 4
4. 2 3 9
5. 2 4 8
6. end
. l
+-----------+
| x y z |
|-----------|
1. | 1 2 8 |
2. | 1 2 2 |
3. | 2 3 4 |
4. | 2 3 9 |
5. | 2 4 8 |
+-----------+
. l if z<5
+-----------+
| x y z |
|-----------|
2. | 1 2 2 |
3. | 2 3 4 |
+-----------+
Now I want to list all the observations for each x and y combination in the former results,i.e.,(x==1 & y==2) | (x==2 | y==3).
I know I can type "l if (x==1 & y==2) | (x==2 | y==3)".
However, typing one by one is troublesome if the number of the combinations for the former results is large.
I know -levelsof- can solve the problem if not the combination but just one variable.
Is there a way like -levelsof- ?
Thank you!
Grace
*
* 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/