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: RE: String problem


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: RE: String problem
Date   Tue, 18 Mar 2014 15:45:10 +0000

The package is called -egenmore-, as Joe correctly states, but the
command using any function from that package will still be -egen-, not
-egenmore-.
Nick
[email protected]


On 18 March 2014 15:36, Joe Canner <[email protected]> wrote:
> Carlos,
>
> If "*/" is not the only problematic string you have to deal with you can invoke -subinstr()- multiple times (see Nick's post for the syntax) for each character or string you want to get rid of.
>
> Alternatively, you can get the -egenmore- command from SSC and do
>
> . egenmore newvar=sieve(oldvar), omit("*/")
>
> adding additional characters to the -omit()- option as necessary.
>
> Regards,
> Joe Canner
> Johns Hopkins University School of Medicine
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Carlos Avellaneda Suárez
> Sent: Tuesday, March 18, 2014 11:22 AM
> To: [email protected]
> Subject: st: String problem
>
> Dear Statalist,
>
> I have to merge several datasets where my key variable is a string
> variable, with no specific rule about the length of each string
> observation. The problem is that there are some characters (i.e. */)
> that are mistakenly added at the end of some observations. I would
> like to know how to eliminate those characters because they are
> causing me troubles when I merge the datasets. I am sorry if this is a
> basic question, but I have never faced this problem before and I don't
> know how to solve it.
>
> Here is an example of what I have:
>
> ref
> WG1855515
> WG1855515*/
> WIN18555R15
> WIN18555R15*/
> PCAV
> PCAV*/
> HKK20560R16
> HKK20560R16*/
>
> Here is what I would like to obtain:
>
> ref
> WG1855515
> WG1855515
> WIN18555R15
> WIN18555R15
> PCAV
> PCAV
> HKK20560R16
> HKK20560R16
>
> Any help is highly appreciated. Best regards.
> Carlos
> *
> *   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