Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: Analysis admissions after liver transplant

 From Matthew White To statalist@hsphsun2.harvard.edu Subject Re: st: Analysis admissions after liver transplant Date Tue, 3 Jan 2012 13:23:09 -0500

```Hi Anwar,

See:

SJ-2-1  pr0004  . . . . . . . . . . Speaking Stata:  How to move step
by: step        . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . .  N. J. Cox        Q1/02   SJ 2(1):86--102
(no commands)
Also, -year + (real(substr(quarter, 2, 1)) - 1) / 4- is used to add
quarter to year for a single number.

Best,
Matt

On Tue, Jan 3, 2012 at 12:44 PM, Dudekula, Anwar <dudekulaan@upmc.edu> wrote:
> Hi Matt,
>
> I am sorry to post  this basic question .
>
> But how does this logic that you wrote work
>
> 1)(generate firsttransplant = year + (real(substr(quarter, 2, 1)) - 1) /4 if livertransplant == "yes"
> 2)bysort pseudoid (firsttransplant): replace firsttransplant = firsttransplant[1]
> 3)keep if year + (real(substr(quarter, 2, 1)) - 1) / 4 > firsttransplant
>
> Thank you,
> Yours Sincerely,
> Anwar Dudekula
>
> ________________________________________
> From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] on behalf of Matthew White [mwhite@poverty-action.org]
> Sent: Monday, December 19, 2011 8:34 PM
> To: statalist@hsphsun2.harvard.edu
> Subject: Re: st: Analysis admissions after liver transplant
>
> Hi Anwar,
>
>
> generate firsttransplant = year + (real(substr(quarter, 2, 1)) - 1) /
> 4 if livertransplant == "yes"
> bysort pseudoid (firsttransplant): replace firsttransplant = firsttransplant[1]
> keep if year + (real(substr(quarter, 2, 1)) - 1) / 4 > firsttransplant
>
> Best,
> Matt
>
> On Mon, Dec 19, 2011 at 12:25 PM, Dudekula, Anwar <dudekulaan@upmc.edu> wrote:
>> Hi,
>>
>> I am here with posting a de-identified data for patients with liver transplant
>>
>> --The patients  with liver disease get admitted multiple times to the hospital.During one of the admission, they get liver transplant based on their degree of sickness.They can get re-admitted to the hospital after liver transplant for  complications related to transplant.To explore this issues, we want to evaluate the admissions after they get the liver transplant
>>
>> --For example  patient with pseudoid-1 gets liver transplant in 4th quarter .That patient gets admitted three times subsequently but patient with pseudiid-9 gets liver transplant during second admission and has three successive admissions after that
>>
>> --So I want to pick up the observations after the liver transplant( eventhough they may not get a liver transplant during that admission)
>>
>>
>> The data contains
>> --pseudoid, whcih is unique for the patient
>> --sysid is unique for each quarter of a year
>> --Q1,Q2,Q3,Q4 are 4 quarters of the year
>>
>>
>>
>>        pseudoid     sysid   year    quarter     livertransplant |
>>     |------------------------------------------------------------|
>>  1. | pseudoid-1   0220890   2008         Q4    yes              |
>>  2. | pseudoid-1   0229499   2009         Q2    no           |
>>  3. | pseudoid-1   0234526   2009         Q3    no               |
>>  4. | pseudoid-2   0234997   2010         Q2    no               |
>>  5. | pseudoid-3   0248508   2008         Q1   yes               |
>>     |------------------------------------------------------------|
>>  6. | pseudoid-4   0227009   2008         Q2   no                |
>>  7. | pseudoid-4   0483263   2008         Q3   yes               |
>>  8. | pseudoid-5   0483419   2008         Q2   no                |
>>  9. | pseudoid-6   0228531   2008         Q1   yes               |
>>  10. | pseudoid-7   0227324   2009         Q3   no                |
>>     |------------------------------------------------------------|
>>  11. | pseudoid-9   0227325   2008         Q1   no                |
>>  12. | pseudoid-9   0227326   2008         Q2   yes               |
>>  13. | pseudoid-9   0227327   2008         Q3   no                |
>>  14. | pseudoid-9   0482471   2008         Q4   no                |
>>  15. | pseudoid-9  0231492    2009         Q2   no                |
>>
>>
>>
>>
>> Yours sincerely
>> Anwar
>> *
>> *   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/
>
>
>
> --
> Matthew White
> Data Coordinator
> Innovations for Poverty Action
> 101 Whitney Avenue, New Haven, CT 06510 USA
> +1 434-305-9861
> www.poverty-action.org
>
> *
> *   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/
>
>
> *
> *   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/

--
Matthew White
Data Coordinator
Innovations for Poverty Action
101 Whitney Avenue, New Haven, CT 06510 USA
+1 434-305-9861
www.poverty-action.org

*
*   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/
```