In addition, I advise verifying the leading characters, particularly in the
second (and any subsequent) variables. You want to make sure that such
values as "0010" and " 10" are always the same or are always different, as
appropriate. Sometimes frequencies on a position by position basis are
helpful.
Bryan Sayer
Statistician, SSS Inc.
[email protected]
-----Original Message-----
From: Nick Cox [mailto:[email protected]]
Sent: Thursday, July 03, 2003 12:07 PM
To: [email protected]
Subject: st: RE: combining string vars
Erica Seiguer
>
> if i have two string variables, is it possible to combine
> them? ie, the
> first var is two digits referring to a state (i.e. 44) and
> the second var is
> 4 digits referring to facility number (i.e. 0010). I want a
> var to look like
> 440010.
Yes. Basically, + means concatenation
with strings (i.e. string variables or more generally
expressions which are or which evaluate to strings)
on either side.
gen strboth = strvar1 + strvar2
gen strboth2 = strvar1 + " " + strvar2
Also check out -egen, concat()-.
Nick
[email protected]
*
* 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/
*
* 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/