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: String with embedded quotes and local macros


From   Michael Costello <[email protected]>
To   Statalist <[email protected]>
Subject   st: String with embedded quotes and local macros
Date   Sun, 24 Mar 2013 13:51:52 -0400

Hello Statalisters,

I'm trying to take some text from a spreadsheet that has embedded
double quotes (dateset 1) and convert it into a value label in another
(dateset 2). Currently I'm trying to do this by using local macros to
bridge the gap as I switch from one dataset to the other.

Let's say the long string of the value label in questions is: 1 "The"
2 "quick" 3 "brown" 4 "fox jumps over" 5 "the" 6 "lazy dog."

Yet, every time I try to run the function below, all (or almost all)
of my spaces get pushed out! Does anyone have a way that I can try to
keep these spaces still included. Specifically, I mean the spaces
between the numbers and their corresponding label values. In the end,
I will need to peel part of the value label off to be part of the
variable label, so I think the spaces become important for that
function. Also, when I do a -wordcount- function on the saying, is
there any way that I can get Stata to treat "fox jumps over" all as
one . . . um . . . word?

local text `"1 "The" 2 "quick" 3 "brown" 4 "fox jumps over" 5 "the" 6
"lazy dog.""'
display `text'
1The2quick3brown4fox jumps over5the6lazy dog.

-Michael
--
Michael Costello

"To call in the statistician after the experiment is done may be no
more than asking him to perform a post-mortem examination: he may be
able to say what the experiment died of."  -Sir Ronald Aylmer Fisher,
FRS
*
*   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