--- Richard Pitman wrote:
> 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.
What about this:
*-------------- begin example -----------
clear
input Id week class str1 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
end
reshape wide class , i(Id) j(week)
list, clean
tab treatment class12 if class0 == 3
*------------ end example --------------
(For more on how to use examples I sent to the
Statalist, see :
http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )
Hope this helps,
Maarten
-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands
visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434
+31 20 5986715
http://home.fsw.vu.nl/m.buis/
-----------------------------------------
*
* 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/