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 at the end of May, and its replacement, statalist.org is already up and running.


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

Re: Re st: destring_loop


From   Mahbubeh Parsaeian <mahbobehparsaeian@yahoo.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: Re st: destring_loop
Date   Sat, 18 Aug 2012 04:16:08 -0700 (PDT)

That is very interesting solution. Thanks a lot.


----- Original Message -----
From: Phil Clayton <philclayton@internode.on.net>
To: statalist@hsphsun2.harvard.edu
Cc: 
Sent: Saturday, 18 August 2012, 14:20
Subject: Re: Re st: destring_loop

That also suggests a one line solution to the current problem, assuming the variables are named var1 var2 and so on:

destring var2-var`=c(k)', replace

Phil

On 18/08/2012, at 6:33 PM, daniel klein wrote:
> ...
> Even though it is not needed here, Stata stores the number of
> variables in the current dataset in c(k). A loop would look like
> 
> forv j = 2/`=c(k)' {
>   [...]
> }
> 
> 


*
*   For searches and help try:
*  http://www.stata.com/help.cgi?searchhttp://www.stata.com/support/statalist/faqhttp://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/


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