Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Database problem


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Database problem
Date   Fri, 7 Dec 2012 19:28:06 +0000

Punctuation was awry there:

If I understand this correctly, I would change the structure of the
data so that you have (in -reshape- terms) a -long- not -wide-
structure.


On Fri, Dec 7, 2012 at 7:22 PM, Nick Cox <njcoxstata@gmail.com> wrote:
> If I understand this correctly, I would change the structure of the
> data so that you have (in -reshape- terms, a -long- not -wide-
> structure).
>
> Even after reversal, this is going to be very awkward to work with, so
> it's better to think of another solution.
>
> You probably have some -rename-ing to do first.
>
> Nick
>
> On Fri, Dec 7, 2012 at 7:16 PM, roland andersson <rolandersson@gmail.com> wrote:
>> I have data on 3574 unique patients. In the datase there are first 5
>> identification variables ,age, sex and so on. Thereafter comes a
>> nomber of variables representing observations. Each observation has
>> three columns - the sequential number of the observation, the content
>> of the observation and the date. The problem is that these observation
>> are in reverse order, ie the last observation comes first and the
>> first observation last in the row. And the number of observations for
>> each patient range from 1 to 44. Some observations have the same date
>> so they have the same sequential number. below is the data. Var 7, var
>> 10 and var 13 are the number of the observation, var 8, 11, and 14 the
>> observation (the diagnosis or intervention) and var 9, 12 and 15 the
>> date of the observation.
>>
>> I want to reverse the order so that the first observation comes in as
>> var 7 etc. I also want to merge observations with the same date with a
>> new combined content. case nr 1 below sholuld thus be 1
>> diverticulitsigmo 15930. Is this possible?
>>
>> Regards
>> Roland Andersson
>>
>>  var7 var8 var9 var10 var11 var12 var13 var14 var15
>> 1 diverticulit 15930 1 sigmo 15930
>> 1 akutiverticulit 16670 1 sigmo 16670
>> 3 akutiverticulit 17126 2 akutiverticulit 16962 1 akutiverticulit 16359
>> 2 akutiverticulit 17019 1 akutiverticulit 17019
>> 1 akutiverticulit 15831 1 resektion 15831
>> 1 akutiverticulit 16129
>> 3 ctbuk 16839 2 sigmo 16838 1 akutiverticulit 16532
>> *
>> *   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index