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 on April 23, and its replacement, is already up and running.

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

Re: st: Grouping variables

From   "Katya Mauff" <>
To   <>
Subject   Re: st: Grouping variables
Date   Fri, 05 Mar 2010 14:59:42 +0200

Dear Alejandra
Try using an if statement. So for example:
gen province=a if (city=="b"|city=="c"|city=="d")
replace province=b if (city=="e"|city=="f"|city=="g")
I know it's slightly tedious, esp if you have several cities/provinces. Perhaps someone else can come up with a quicker way to do it.

>>> <> 2010/03/05 02:47 PM >>>
Dear Statalits,
In my database I have a variable, called "city" which represent firms'
main base. It is a string variable that I've already encoded in an
I have a lot of other information about the firms and I need to work at a
more aggregated level, for instance "province", could you please tell me
how to assign different cities to one province?
Thanks in advance.
Best regards,

*   For searches and help try:

*   For searches and help try:

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