Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: manipulating string variables


From   Jean Eid <jeaneid@chass.utoronto.ca>
To   stata <statalist@hsphsun2.harvard.edu>
Subject   st: manipulating string variables
Date   Fri, 21 Jul 2006 10:21:55 -0400

I have been trying to do the following with no luck (This is a simplification rather than exact procedure needed)

Suppose I declare a global variable
global myglobal "hello world, how are you today"

now what I want to do is the following:
a) see whether the string text today exist in $myglobal
b) replace "today" by "tomorrow"
c) instead of "are" I need to change the "a" to "b" let's say.

I know this does not make sense to you right now but I have all these regressions defined as global variables and need to manipulate them.

Can this be done in Stata?

I have checked strmatch and the likes but am not able to work it. I am looking for something like grep, sub and the likes in Linux.

If you know how to do this Please provide a workable example.


Thank you for your time

Jean

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index