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]
Re: st: Need help with combing observations by using by: command along with subscripting
From
Steve Nakoneshny <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: Need help with combing observations by using by: command along with subscripting
Date
Wed, 6 Feb 2013 10:45:26 -0700
Mike,
Your subscript is pointing in the wrong direction. try substituting [_n+1] in your code. I suspect you will obtain the desired result.
Steve
On 2013-02-06, at 10:12 AM, Michael Stewart wrote:
> Hi,
>
> I need help with following data where I am trying to combine
> observations for each patient
>
> PATIENTno dtbirth medicalrecordnumber accountnumber
> 1 8/10/1907 1111111
> 1 . dddddddd
> 2 12/14/1910 222222222
> 2 . eeeeee
> 3 4/16/1914 33333333 rrrrrrr
>
>
> PATIENTno,medicalrecordnumber & accountnumber -->STRING format
>
> dtbirth-->%td format
>
>
> I need to combine row one and row two for patient 1 so that resultatnt
> row will have information from both rows one and row two
>
> I tried to use subscripting as follows
>
> bysort PATIENTno dtbirth: repalce medicalrecordnumber= medicalrecordnumber[_n-1]
>
> then all values for the medicalrecordnumber are turning to blank spaces
>
> I also tried bysort PATIENTno dtbirth: repalce medicalrecordnumber=
> medicalrecordnumber[1] but it didnt work either.
>
> Can you please help.
>
> --
> Thank you ,
> Yours Sincerely,
> Mike.
> *
> * 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/
*
* 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/