Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: -listtex- header: more than 502 characters possible?


From   "Newson, Roger B" <r.newson@imperial.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: -listtex- header: more than 502 characters possible?
Date   Sun, 18 Feb 2007 17:42:44 -0000

I too would definitely like to know the answer to this question. I find
exactly the same 502-character limit when I run Friedrich's example
under my Intercooled Stata 9.2 (also under Windows XP) and open the
output file in my text editor (TextPad Version 4.7.3). I have not
knowingly programmed this limit into -listtex-, which stores the header
lines as a macro and outputs them using the -file- command and the macro
function -macval()-. (The code is included below in case anybody wants
to check.) The 502-character limit persisted when I experimentally
updated -listtex- to Stata 9 (it is currently Stata 8), so it does not
seem to be connected with the old Intercooled Stata 8 limits. As I have
not explicitly included a 502-character limit in -listtex-, and as the
limit to the length of a macro is 67,784 characters (not 502
characters), it seems that the limit that Friedrich and I have
encountered is probably either in Stata or in Windows XP. It does not
seem to be in TextPad, bexause it persists when I use the -type- option
of -listtex- instead of a -using- qualifier, causing the output to be
routed to the Stata log. It is not likely to connected with a limit on
the length of a Stata command line, as that limit is 67,800 in
Intercooled Stata 9 (according to the on-line help for -limits-). Might
it be a problem with the -file- command?

Best wishes

Roger


**** BEGINNING OF Stata CODE - CUT HERE
*
 Copy temporary output file to permanent output file,
 adding headlines and footlines if requested *;
local nhead:word count `headlines';
local nfoot:word count `footlines';
if `nhead'<=0 & `nfoot'<=0 {;
  * No headlines or footlines *;
  copy `tempout' `using', text `replace';
};
else {;
  tempfile tempout2;
  tempname handle1 handle2;
  file open `handle2' using `tempout2', write text;
  forv i1=1(1)`nhead' {;
    local linecur:word `i1' of `macval(headlines)';
    file write `handle2' `"`macval(linecur)'"' _n;
  };
  file open `handle1' using `tempout',read;
  file read `handle1' linecur;
  while r(eof)==0 {;
    file write `handle2' `"`macval(linecur)'"' _n;
    file read `handle1' linecur;
  };
  file close `handle1';
  forv i1=1(1)`nfoot' {;
    local linecur:word `i1' of `macval(footlines)';
    file write `handle2' `"`macval(linecur)'"' _n;
  };
  file close `handle2';
  copy `tempout2' `using', text `replace';
};
**** END OF Stata CODE - CUT HERE

Roger Newson
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
UNITED KINGDOM
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: r.newson@imperial.ac.uk 
www.imperial.ac.uk/nhli/r.newson/

Opinions expressed are those of the author, not of the institution.

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Friedrich
Huebler
Sent: 17 February 2007 22:45
To: statalist@hsphsun2.harvard.edu
Subject: st: -listtex- header: more than 502 characters possible?

I use Stata/SE 8.2 and save data in text files with -listtex- from
SSC. When I specify a long header with -listtex, head()- and open the
saved file in a text editor, only the first 502 characters of the
header appear in one line. The additional characters appear in a new
line. The editor itself can display lines with more than 502
characters. The problem can be reproduced with the following
commands.

sysuse auto
forvalues i = 1/52 {
  local head "`head'1234567890"
}
listtex make price using "listtex.txt", head("`head'")

Which limit do I encounter and how can it be overcome? Is this a
limitation of -listtex-, Stata, or Windows XP?

Friedrich



 
________________________________________________________________________
____________
Don't get soaked.  Take a quick peak at the forecast
with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather
*
*   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