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: SV: Combining string and numeric variables


From   Nick Cox <njcoxstata@gmail.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: SV: Combining string and numeric variables
Date   Wed, 4 Dec 2013 12:08:47 +0000

To get a composite variable, this is, in spirit, what is recommended
in Stata Tip 52, which I mentioned earlier. The syntax would be more
like

egen Country_Region = group(Country Region), label

as -group()- is an -egen- function.

Something like

reshape wide var, i(Country Region)

or

reshape wide var, i(Country_Region)

wouldn't work without a -j()- option.

Nick
njcoxstata@gmail.com


On 4 December 2013 11:29, Christian Trolle <CHRISTIAN.TROLLE@ki.au.dk> wrote:
> Is it possible to do it like this
>
> gen Country_Region = group(Country Region), label
>
> and then use reshape wide var (i) (Country Region)
>
>
Miguel A. Duran

I have a panel data set in long form. This panel data set has two
variables to identify observations, one for country (eg, UK) and one
for region (eg, 11 or M0). I have to transform the dataset into wide
form.
> Nevertheless, to do this, if I am not mistaken, previously I have to combine these two identifying variables (to generate, eg, values such as UKM0). Does anyone know whether this can be done with Stata? Thanks 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