Statalist


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

Re: st: Re: creating a varlist


From   "Radu Ban" <raduban@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Re: creating a varlist
Date   Wed, 22 Oct 2008 14:59:01 -0400

yes, this helped a lot. if i define the macro without using the equal
sign, it works.

thanks for this,
Radu

2008/10/22 Martin Weiss <martin.weiss1@gmx.de>:
> see http://www.stata.com/statalist/archive/2008-05/msg00629.html
>
> HTH
> Martin _______________________
> ----- Original Message ----- From: "Radu Ban" <raduban@gmail.com>
> To: <statalist@hsphsun2.harvard.edu>
> Sent: Wednesday, October 22, 2008 8:39 PM
> Subject: st: creating a varlist
>
>
>> Dear Statalist,
>>
>> I want to generate a variable with the -egen anycount- command.
>>
>> let's say:
>>
>> egen ttt = anycount(`vlist'), v(1)
>>
>> The varlist in the argument is long and the variables have some
>> regularity in their names. They all of the form qX3_1 qX3_2, where X
>> goes from 5 to 46. Note that there are other variables with X between
>> 1 and 4 which I do not want, so that a varlist q*3_1 q*3_2 does not
>> work. To create my variables list I did the following:
>>
>> local vlist ""
>> forvalues n = 5/46 {
>> local vlist = "`vlist' q`n'3_1 q`n'3_2"
>> }
>> *then to check
>> di "`vlist'"
>>
>> However, the display command shows that the macro stops at q23. Am I
>> running into a limit here? I checked help limits and the limit to
>> number of characters in a macro is way higher ( 1,081,511 in Stata
>> SE). If indeed there is a limit, can anyone point out a work around?
>>
>> Thank you,
>> Radu
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/statalist/faq
>> *   http://www.ats.ucla.edu/stat/stata/
>>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>



-- 
picasaweb.google.com/raduban
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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