Bookmark and Share

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: collapsing in a way to display the different values for a variable in a row


From   Raffaele Palladino <[email protected]>
To   [email protected]
Subject   st: collapsing in a way to display the different values for a variable in a row
Date   Wed, 5 Feb 2014 12:26:18 +0000

Dear statalist users I am dealing with this problem:

I have a huge dataset where one of the variables lists different kind of medication ("treatment", string variable). Each person can take different medication so for every value of the variable "idperson" I have several records, each with a different value of the variable "treatment". Just to give you an idea this is how the dataset looks alike:

idperson		date						treatment
1				01February2000					a
1				15March2001					b
1												c
2												b												
2												c
2												e
2												d
3												a	
     

Is there a way, maybe using collapse to have for each id person as much date and treatment variable as the real records for each idperson are?
something like:

idperson		date1		treatment1	date2	treatment2 and so on...

thank you in advance!



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


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index