Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: how to read very long text lines?


From   "Li Chuntao (Tony)" <leechtcn@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: how to read very long text lines?
Date   Fri, 8 Mar 2013 12:22:44 +0800

Dear Listers,

    I want to use Stata to read a text file line by line. Suppose the
file is d:\temp.txt. one of the line i specially interested is very
long, more than 1000 characters. I use the following code to read:

capture file close myread
file open myread using d:\temp.txt , read text
file readmyrea line
while r(eof)==0 {
  local linenum = `linenum' + 1
  local myline=`" `macval(line)'"'
  disp length(`"`macval(myline)'"')
  file myrea hexun line

}
file close hexun

It seems that the maximium length for a string here is only 240.

Is it possible to change it to longer?

thanks

Tony
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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