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

st: infix not read space at end of string


From   Koleman Strumpf <[email protected]>
To   [email protected]
Subject   st: infix not read space at end of string
Date   Sat, 12 Apr 2003 18:07:17 -0400 (EDT)

I am trying to have stata-se read in some strings from a file, but for
some reason it omits a blank space at the end of one of the strings.
Consider the following one line file, test.txt

-----<test.txt> starts on next line-----
try this stuff
-----<test.txt> ends on previous line>

Then in stata-se (I have tried both interactive and an x-windows version)
I have the following session:

-----stata-se session starts-----
. infix str var1 1-9 str var2 10-14 using test.txt
(1 observations read)

. list if var1=="try this"

     +------------------+
     |     var1    var2 |
     |------------------|
  1. | try this   stuff |
     +------------------+

. list if var1=="try this "


. list if var2=="stuff"

     +------------------+
     |     var1    var2 |
     |------------------|
  1. | try this   stuff |
     +------------------+
-----stata-se session ends-----

Notice that the space at the end of var1 is missing--the nineth character
in the test.txt file is a space. Does anyone have a suggestion on what is
going on here?

Thanks,
Koleman

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