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

st: RE: append


From   "Nick Winter" <[email protected]>
To   <[email protected]>
Subject   st: RE: append
Date   Mon, 7 Apr 2003 15:05:00 -0400

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/



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