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]
st: String task
Daniel Marcelino <firstname.lastname@example.org>
st: String task
Fri, 1 Apr 2011 15:24:32 -0300
Now I'm troubling to drop out a remain part of quote " and ' from
string. How can I weit it inside of quotes. Stata return me an error
too few quotes
replace TSEid = subinstr(TSEid, " " ", "", .)
On Fri, Apr 1, 2011 at 3:02 PM, Daniel Marcelino <email@example.com> wrote:
> Nice, "replace day = subinstr(day, "/", " ", 1)" is more intuitive
> and clear than
> "g day2 = substr(day,(strpos(day,"/")+1),.)" although the second did
> the job exactly as I wanted.
> On Fri, Apr 1, 2011 at 2:27 PM, Nick Cox <firstname.lastname@example.org> wrote:
>> As Kit Baum pointed out to me privately, this will produce one more
>> variable than the number of slashes, so three in this example.
>> To get exactly what Daniel wanted, here is another way:
>> replace day = subinstr(day, "/", " ", 1)
>> split day
>> That is, the first / is replaced by a space.
>> On Fri, Apr 1, 2011 at 4:56 PM, Austin Nichols <email@example.com> wrote:
>>> Daniel Marcelino <firstname.lastname@example.org>:
>>> input str8 day
>>> split day, p(/)
>> On Fri, Apr 1, 2011 at 11:51 AM, Daniel Marcelino <email@example.com> wrote:
>>>> I have I task with string that is split a string into two vars.
>>>> So every character before first "/" slash if is there, must be copied
>>>> to var1. Also, everything after "/" slash or if there is no "/"
>>>> everything in the cell must be placed into var2.
>>>> How can I do it?
>> * 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: