Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: ` ' syntax


From   Nick Winter <[email protected]>
To   [email protected]
Subject   Re: st: ` ' syntax
Date   Thu, 29 Sep 2005 15:00:55 -0400

I don't think that local macros are actually relevant.

How about something like this:

. replace match = match + ", 5" if ...

In the context of a string variable, the "+" operator means concatenation, not addition.

Nick Winter

At 02:54 PM 9/29/2005, you wrote:

Dear Statalist,

Does anyone know if there is a similar syntax to `x' for string variables?

I have a string variable which might have contents like:
1, 2, 3, 4

I want to replace this string, under certain conditions, with something
like:
1, 2, 3, 4, 5

i.e. I want to keep the string and append ", 5", for example, to the end.

What I have written is this, but I realized the `myvar' notation only makes
sense when myvar is numeric.

replace match="`match', `y'" if ... Where y is numeric.

Again, ideas?  Thanks so much.
Terra

*
*   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/
________________________________________________________
Nicholas J. G. Winter 607.255.8819 t
Assistant Professor 607.255.4530 f
Department of Government [email protected] e
Cornell University falcon.arts.cornell.edu/nw53 w
308 White Hall
Ithaca, NY 14853-4601

*
* 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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index