Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: defining selection criteria


From   Philip Ryan <[email protected]>
To   [email protected]
Subject   Re: st: defining selection criteria
Date   Thu, 29 Mar 2007 18:47:14 +0930

. reshape wide class , i(id) j(week)
(note: j = 0 8 12)

Data                               long   ->   wide
-----------------------------------------------------------------------------
Number of obs.                        9   ->       3
Number of variables                   4   ->       5
j variable (3 values)              week   ->   (dropped)
xij variables:
                                  class   ->   class0 class8 class12
-----------------------------------------------------------------------------

. li

     +-------------------------------------------+
     | id   class0   class8   class12   treatm~t |
     |-------------------------------------------|
  1. |  1        2        3         3          a |
  2. |  2        3        3         4          b |
  3. |  3        3        3         2          a |
     +-------------------------------------------+

. tab treat class12 if class0==3

           |       12 class
 treatment |         2          4 |     Total
-----------+----------------------+----------
         a |         1          0 |         1
         b |         0          1 |         1
-----------+----------------------+----------
     Total |         1          1 |         2

Phil



Quoting Richard Pitman <[email protected]>:

> I have a dataset like the following
>
> Id	week	class	treatment
> 1	0	2	a
> 1	8	3	a
> 1	12	3	a
> 2	0	3	b
> 2	8	3	b
> 2	12	4	b
> 3	0	3	a
> 3	8	3	a
> 3	12	2	a
>
> I would like to cross tabulate treatment against class at week 12, ~but~
> only for those patients in class 3 at week 0. I am not sure how to achieve
> the last criteria.
>
> Any suggestions gratefully received.
>
> Richard Pitman
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>


-- 
Philip Ryan
Associate Professor
Discipline of Public Health

Director, Data Management and Analysis Centre
Associate Dean (IT)
Faculty of Health Sciences

University of Adelaide
5005 South Australia
AUSTRALIA
CRICOS Provider Number 00123M
-----------------------------------------------------------
This email message is intended only for the addressee(s)
and contains information that may be confidential and/or
copyright.  If you are not the intended recipient please
notify the sender by reply email and immediately delete
this email. Use, disclosure or reproduction of this email
by anyone other than the intended recipient(s) is strictly
prohibited. No representation is made that this email or
any attachments are free of viruses. Virus scanning is
recommended and is the responsibility of the recipient.
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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