Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: destring_loop


From   Phil Clayton <[email protected]>
To   [email protected]
Subject   Re: st: destring_loop
Date   Sat, 18 Aug 2012 16:29:06 +1000

One option is to use -ds- with the "not" option:

ds var1, not
destring `r(varlist)', replace

Phil

On 18/08/2012, at 4:15 PM, Mahbubeh Parsaeian wrote:

> I have imported an Excel worksheet to Stata but all numerical variables was converted to string.
> 
> I want to use destring to convert these string variables to numeric for all variables except the first  variable. 
> Imagine there are 10 variables (Var 1 – Var 10) and the first variable should remain in string format.
> I have write the following command and it works correctly.
> destring Var2– Var10, replace
> This conversion (string to numeric) should be done for a lot of data set with varying length and in each data set the first variable should remain in string format.
> I want to write a loop for these task and want to use this command in that loop but I don’t khow how is possible to call second variables till the end as we usually done for numeric values ( for example 2/max)
> Would you please help me to find a good solution?
> Thanks
> 
> *
> *   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index