This answered the question well. But note also that it is not necessary
and not usually a good idea to put a single text string in a variable.
di "The forecast GDP for 2009 is "
illustrates technique. Check out the help for -display-.
Nick
[email protected]
Ulrich Kohler replied to Shruthi JAYARAM
> 2. Is it possible to concatenate strings and numbers into a larger
string?
> For example, I have a variable y and I want to get the output "The
> forecasted GDP for 2009 is y". Can I write a command that intuitively
> carries out this: gen outputstring = paste("The forecast GDP for 2009
is",
> y)
. gen outputstring = "The forcast GDP for 2009 is " + string(y)
see -help operators- and -help string functions-.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/