If you're using FIPS county codes, they're 2-digit state + 3-digit county.
gen int fipscnty = (1000 * state) + county
I'm assuming you want this numeric. You can also create a string code
like this:
gen str5 fipscnty = string(state, "%02.0f") + string(county, "%03.0f")
The "%0#.#f" format creates leading 0s as needed.
-ml
Johannes Schoder wrote:
Dear Statalist users:
I would like to combine two variables in one:
The first variable represents the state: e.g. CA (California) or AZ
(Arizona).
The second variable represents the countiy and includes numbers: 01,...
The combination of both variables finally states from which county the
individual is from, e.g. CA 01 is county Alameda, AZ 01 is county
Apache, etc.
Does anyone know a trick how to combine both variables so that it
identifies uniquely the county where the person is from?
Thanks a lot!!
Johannes
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
--
Michael I. Lichter, Ph.D. <[email protected]>
Research Assistant Professor & NRSA Fellow
UB Department of Family Medicine / Primary Care Research Institute
UB Clinical Center, 462 Grider Street, Buffalo, NY 14215
Office: CC 126 / Phone: 716-898-4751 / FAX: 716-898-3536
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/