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

st: RE: posting a long list


From   "Nick Winter" <nwinter@policystudies.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: posting a long list
Date   Mon, 24 Jun 2002 11:41:34 -0400

> Hello - I'm trying to use -postfile- to post a long list of 
> names stored in
> a macro (I tried both local and global). When I try to build 
> this macro by
> appending each name, one at a time, it refuses to exceed 80 
> characters in
> length. 
> 
> 1. Is there a way to make a macro longer than 80 characters?

My guess is that you are doing something like the following to build up
your list of variable names, inside a loop:

	local longmac = "`longmac' `newpart'"

WHen you use the equals sign, Stata evaluates the stuff to the right,
then assigns it to the macro.  When (non SE) Stata evaluates a string,
it truncates it at 80 characters.

However, in this case you can do the following:

	local longmac "`longmac' `newpart'"

(Note there is no equal sign).  In this case, Stata just puts whatever
is after the macro name in the macro, without evaluating it, and
therefore without truncating it.  You have to be careful subsequently
what you do with the macro, though; if you wanted to make it all lower
case and did this

	local longmac=lower("`longmac'")

you will truncate it again.

This should deal with your problem.  To further clarify the distinction,
try this:

	local x1 = 1+1
	local x2   1+1
	display "x1 is `x1'"
	display "x2 is `x2'"

Nick Winter

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