Statalist The Stata Listserver


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

st: RE: Size of a global


From   "Maarten Buis" <[email protected]>
To   <[email protected]>
Subject   st: RE: Size of a global
Date   Wed, 28 Mar 2007 19:00:32 +0200

--- Mentzakis, Emmanouil wrote:
> I have an example below of what is happening. The first global $xvar is
> working but when I increase its size, as in global $var2 it does not
> work properly anymore.
> ---------Begin example----------
<snip>
> # delimit ;
> global xvar="dmpg2 dmpg3 dmpg4 dmpg5 dmpg6 dmpg7 dmpg8 dmpg9 dmpg10
> dmpg11 dmpg12
> dmpg13 dmpg14 dmpg15 dmpg16 dmpg17 dmpg18 dmpg19 dmpg20 dmpg2";
> # delimit cr;
<snip>
> # delimit ;
> global xvar2="dmpg2 dmpg3 dmpg4 dmpg5 dmpg6 dmpg7 dmpg8 dmpg9 dmpg10
> dmpg11 dmpg12
> dmpg13 dmpg14 dmpg15 dmpg16 dmpg17 dmpg18 dmpg19 dmpg20 dmpg21 dtrunk2
> dtrunk3 dtrunk4
> dtrunk5 dtrunk6 dtrunk7 dtrunk8 dtrunk9 dtrunk10 dtrunk11 dtrunk12
> dtrunk13 dtrunk14 dtrunk15
> dtrunk16 dtrunk17 dtrunk18";
> # delimit cr;


The trick is to remove the equal sign, so type:

global xvar2 "dmpg2 dmpg3 ...

instead of :

global xvar2 = "dmpg2 dmpg3 ...

if you leave out the equal sign Stata won't evaluate whatever comes next, 
and as a result it won't hit the maximum number of characters a string 
may contain (which was the problem you were running in to). 

Hope this helps,
Maarten

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology 
Vrije Universiteit Amsterdam 
Boelelaan 1081 
1081 HV Amsterdam 
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434 

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------



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