Dear Neil,
Thank you very much for this helpful advice. You was right, I had spaces
in the countries names of one of my datasets. I dropped them and succeeded
in merging.
Best regards
Isabelle
> On Mon, Mar 9, 2009 at 12:06 PM, <[email protected]> wrote:
>> Hello,
>>
>> I have two datasets: the first one, called "country" gives some
>> characteristics of 221 countries (GDP, population...), the second one,
>> called "safety", contains 24 countries with the variable "safety public
>> expenditures"
>>
>> I want to merge these databases, by keeping all the countries. So I
>> write:
>> ...........
>> use base_pays\country.dta, clear
>> sort country
>> merge country using GFS\safety
>> sort _merge
>> ......
>>
>> The problem is that Stata accepts to merge (I have no error message),
>> but
>> indeed my datasets are not merged: the common countries are repeated two
>> times, and _merge just takes values 1 and 2. So I really don't know what
>> to do.
>>
>
> The -man merge- page informs you what the various values _merge can
> take and what they signify (which in turn points to the source of your
> problem).
>
> But in summary it means that whilst you have the same variable name in
> both data sets for merging them (the variable 'country') there are no
> values in either file which are common to both data sets, hence you
> get no matches.
>
> This could be down to captilisation in one file and not the other, or
> unwanted spaces in values, or that there genuinely isn't anything in
> base_pays\country.dta dataset that matches GFS\safety.dta
>
> Thus, the starting point is to ensure that the values for country in
> your GFS/safety.dta file match the corresponding entries in
> base_pays/country.dta. You can do this using either -tabulate oneway-
> or -levelsof-
>
> Neil
>
>
> --
> "The combination of some data and an aching desire for an answer does
> not ensure that a reasonable answer can be extracted from a given body
> of data." ~ John Tukey (1986), "Sunset salvo". The American
> Statistician 40(1).
>
> Email - [email protected]
> Website - http://slack.ser.man.ac.uk/
> Photos - http://www.flickr.com/photos/slackline/
> *
> * 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/
>
*
* 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/