Many thanks for the quick reply.
I should have said that I did trim both datasets before attempting to append
them. I used the same command that Nick Winter suggested. And I still had
the same problem.
However, there is a new twist.
After I sent the message to the STATA list I closed STATA - which had been
open for the past 7 hours. Once I got the replies I decide to look at the
problem for one last time. I ran STATA, and executed the same do file which
I had been using since early today. For my surprise the do file worked
perfectly well, not producing the unexpected results that I had first
experienced.
I guess all I had to do in the first place was to restart STATA.
All the best,
Joao Pedro
-----Original Message-----
From: [email protected]
[mailto:[email protected]]On Behalf Of Nick Winter
Sent: Monday, April 07, 2003 8:05 PM
To: [email protected]
Subject: st: RE: append
A wild guess: there are leading spaces in the names from one of the two
sources, and to Stata "Aztec" is not the same as " Aztec", and so on.
Perhaps Excel strips the leading space(s).
Try this:
. replace region=trim(region)
which will strip any leading and trailing spaces.
Nick Winter
-----------------------------------------------------------
Nicholas Winter, Ph.D. P 202.939.5343
Policy Studies Associates F 202.939.5732
1718 Connecticut Avenue, NW [email protected]
Washington, DC 20009-1148 www.policystudies.com
-----------------------------------------------------------
> -----Original Message-----
> From: Joao Pedro W. de Azevedo [mailto:[email protected]]
> Sent: Monday, April 07, 2003 2:56 PM
> To: [email protected]
> Subject: st: append
>
>
> Dear Statausers,
> I've just joined two datasets using the append command on
> STATA7, however
> I'm having a problem.
> When I ask to tabulate the variable region (string), which
> was present on
> both datasets I get the following simplified output:
>
> region | Freq.
> ---------------------------------------+-----------------
> Aztec | 18
> Barnsley and Doncaster | 18
> Bedfordshire | 18
> Birmingham | 18
> Aztec | 15
> Barnsley and Doncaster | 15
> Bedfordshire | 15
> Birmingham | 15
>
> The problem here is that for some reason STATA does not
> recognize that the
> names are the same, and tabulates them as if they two Aztec
> regions were
> completelly different.
> For some random reason I copied the entiere collum with this
> particular
> variable to Excell, and then copied back to the same STATA
> file, creating a
> new variable (var158). Please not that I did not modify this
> variable in any
> way, while I had it on Excell.
> For some reason, when I tabulate this new variable, STATA
> does recognize
> that the name of the region were the same and produce the
> correct output
> (bellow).
>
>
> var158 | Freq.
> -------------------------------------+----------------
> Aztec | 33
> Barnsley and Doncaster | 33
> Bedfordshire | 33
> Birmingham | 33
>
> I would like to know if anyone could give me an idea of what
> is happening,
> and how I could fix this within STATA itself.
> Many thanks,
> Joao Pedro/
>
>
>
>
>
>
> *
> * 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/
>
*
* 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/
*
* 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/