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: Extracting part of string var


From   Rohit Sonika <[email protected]>
To   Statalist <[email protected]>
Subject   Re: st: Extracting part of string var
Date   Tue, 10 Dec 2013 22:00:03 +0000

Perfect!

Thanks, Nick!

On 10 Dec 2013, at 21:58, Nick Cox <[email protected]> wrote:

> replace var = subinstr(var, ".", "", .)
> 
> 
> Nick
> [email protected]
> 
> 
> On 10 December 2013 21:55, Rohit Sonika <[email protected]> wrote:
>> Hi Statalist,
>> 
>> I am trying to extract part of string variable that looks something like this:
>> 
>> var
>> ..1…….2….3
>> 1..3………..2
>> ……..2..1..1.
>> 
>> The occurrence of 1, 2 and 3 are randomly placed and no predefined order. I am trying to obtain just the numeric part of the variable so that I am able to retain the order of numbers: 123, 132 and 211 in the example above. Hence, I am only trying to remove the dots (.) from the string variable.
>> 
>> I am running Stata 13 on Mac 10.9.
>> 
>> Thanks for your help.
>> 
>> Rohit
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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