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]

st: Using substr with embedded quotes


From   Simone Peart Boyce <[email protected]>
To   Stata <[email protected]>
Subject   st: Using substr with embedded quotes
Date   Tue, 5 Feb 2013 07:23:50 -0800 (PST)

Hi,

I have a string that contains quotes.  When I try to do use substr to extract a portion of this string, substr seems to ignore everything after the quote.  Here is my example.

local if="if type=="breast""
local x=substr("`if'",3,.)
disp "`x'"
type==

Why is "breast" being ignored?

Thanks in advance,
Simone
*
*   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