Statalist The Stata Listserver

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

Re: st: how to distinguish observations with the same code

From   "natalie chan" <>
Subject   Re: st: how to distinguish observations with the same code
Date   Mon, 7 May 2007 16:30:33 +0100

Hi Jo and Kit,

That's most helpful. I've sorted it out. Thanks so much for your help.



On 5/7/07, Johannes Geyer <> wrote:
as far as I understood the problem, you did not create string variables.
if it is just a cross-sectional data set,  you could generate a simple
index as identifier:
gen x = _n

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

Johannes Geyer
Deutsches Institut für Wirtschaftsforschung (DIW Berlin)
German Institute for Economic Research
Graduate Center
Koenigin-Luise-Straße 5
14195 Berlin, Germany
Tel: +49-30-89789-258

*   For searches and help try:

*   For searches and help try:

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