Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: append (Stata restart)


From   "Joao Pedro W. de Azevedo" <jazevedo@provide.com.br>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: append (Stata restart)
Date   Mon, 7 Apr 2003 20:32:54 +0100

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: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of Nick Winter
Sent: Monday, April 07, 2003 8:05 PM
To: statalist@hsphsun2.harvard.edu
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     nwinter@policystudies.com
 Washington, DC 20009-1148           www.policystudies.com
-----------------------------------------------------------

> -----Original Message-----
> From: Joao Pedro W. de Azevedo [mailto:jazevedo@provide.com.br]
> Sent: Monday, April 07, 2003 2:56 PM
> To: statalist@hsphsun2.harvard.edu
> 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/



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