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: Splitting the contents of a cell with enter key as the delimiter
From
Nick Cox <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: Splitting the contents of a cell with enter key as the delimiter
Date
Tue, 3 Dec 2013 18:10:02 +0000
1. As the help for -split- explains that recipe using char(9) is for
tabs. Whatever you have are not tabs. You need to try other codes e.g.
for CR, LF. Sergiy made the same point.
2. -charlist- in the form you quote can't show non-printable
characters. You need to look at its returned results, specifically
r(ascii). That is documented too. It should be sufficient to do
something like
charlist myvar in 42
for any observation showing these extra characters.
3. Stata not STATA please.
Nick
[email protected]
On 3 December 2013 17:58, Dev Vencappa <[email protected]> wrote:
> Thanks Nick.
>
> I have tried -split- with the -parse- option as below (I hope I am using this correctly):
>
> split fullname, p(`=char(9)')
>
> but this did not work (i.e. it produced a new variable called fullname1 which is exactly the same as variable fullname)
>
> I have tried -charlist- to find out more about the character used as delimiter, and it returns the characters below, which are all present in the contents of the cells, so it is not clear to me what character was used as the delimiter.
>
> &'()*,-./012359>ABCDEFGHIJKLMNOPQRSTUVWYZabcdefghijklmnopqrstuvwxyz{}
>
> I will go back to the original excel file I imported into STATA and see if I can find what the problem is from there.
>
> Dev
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Nick Cox
> Sent: 03 December 2013 17:29
> To: [email protected]
> Subject: Re: st: Splitting the contents of a cell with enter key as the delimiter
>
> I won't rule out that it could be CR and LF together.
>
> -charlist- (SSC) is a simple utility that identifies characters present in string variables.
> Nick
> [email protected]
>
>
> On 3 December 2013 17:08, Nick Cox <[email protected]> wrote:
>> That's not enough information for us to identify which character that
>> is (Stata sense) but from standard lists e.g.
>> http://www.asciitable.com/ it sounds like carriage return or line
>> feed. Either way, -split- should be up to it. There is an example in
>> the help for -split- showing how to split on tabs, meaning -char(9)-,
>> which should be of the same form.
>>
>> This is one example, where the Statalist convention, urged upon you
>> all by the FAQ but adopted only by a few, of flagging syntax with - -
>> is really helpful, as in
>>
>> I am using the -split- command.
>>
>> Nick
>> [email protected]
>>
>>
>> On 3 December 2013 16:46, Dev Vencappa <[email protected]> wrote:
>>
>>> I am trying to split the contents of a string variable which reads as one long name as below when viewing it in the data editor:
>>>
>>> Banc of America Securities LLCJP Morgan & Co IncMorgan Stanley
>>>
>>> But upon closer inspection, this is actually stored with the enter key as a delimiter in the cell as below:
>>>
>>> Banc of America Securities LLC
>>> JP Morgan & Co Inc
>>> Morgan Stanley
>>>
>>> I am trying to use the command split to retrieve and save each of these three business names into three different columns. However, I am not sure how to code split to specify thatthe parser should be the enter key. Can someone please kindly offer a solution to this please? My string variable has thousands such cases where sometimes there are up to 15 different names in the content of a cell delimited using the enter key.
>
> *
> * 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/
> This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.
>
> This message has been checked for viruses but the contents of an attachment
> may still contain software viruses which could damage your computer system, you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.
>
>
>
>
>
> *
> * 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/