Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Using substr with embedded quotes

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


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'"

Why is "breast" being ignored?

Thanks in advance,
*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index