Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: how to distinguish observations with the same code


From   Kit Baum <[email protected]>
To   [email protected]
Subject   st: how to distinguish observations with the same code
Date   Mon, 7 May 2007 09:36:54 -0400

sacrificial lamb

Natalie wrote

I have actually created a new variable country to distinguish the
firms before appending, I am wondering if it is possible to create a
new variable combining the information of "code" and "country", so
that the observations can be distinguished by one variable? Thanks
alot.

This is a FAQ.

gen idcode = country + string(code)

If you want a fixed length code (assuming countrycode is of fixed length, e.g. ISO) then use string(code,"%9.0f") or something like that.


Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html


*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index