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]

Re: st: RE: Reshape from long to wide and attaching Labels contained in a Variable.


From   Phil Schumm <[email protected]>
To   <[email protected]>
Subject   Re: st: RE: Reshape from long to wide and attaching Labels contained in a Variable.
Date   Thu, 29 Aug 2013 21:15:39 -0500

On Aug 29, 2013, at 7:20 PM, Stefan Schöftner <[email protected]> wrote:
> My goal is to reshape it into wide form because i need unique ID´s for further merging with other datasets with additional information.


If that is why you are reshaping you wide, don't; you can merge just as easily with the data in long form (i.e., using a 1:m or m:1 merge).


> reshape wide title amount, i(id) j(code)
> 
> it would look like this:
> 
> Obs. ID     yy1    yy1Title    yy2  yy2Title    yy3    yy3Title    yy4  yy4Title   yy5   yy5Title
> 
> 1    xxx    Amount  abc
> 2    xxx                    Amount   bcd
> 3    xxx                                      Amount    cda
> 4    xxx                                                         Amount  acb
> 5    xxx                                                                          Amount  cad
> 
> 4th-
> What i´m trying to achiev is now that Titel values are now represented int the variable List as Variable Lables
> 
> Such as:
> 
> Variable                   Label
> ID                     Identification Nr.
> yy1                    (yy1Title) yy1 abc 
> yy2                    (yy2Title) yy2 bcd
> and so forth


In that case, the code I posted will do what you want.


-- Phil


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