Statalist The Stata Listserver


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

RE: st: Join String Variables


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Join String Variables
Date   Sun, 19 Nov 2006 16:50:10 -0000

In addition, 

egen Var4 = concat(Var1 Var2 Var3) 

In this example, -egen, concat()- gains you 
nothing, but it has some other features that 
make it more worthwhile. 

Nick 
n.j.cox@durham.ac.uk 

Svend Juul
 
> Socrates wrote: 
> OK, I know how to split string variables but have not found a 
> way to join string variables. Did a search but could not 
> source something out. Can you direct me to a command? Or if 
> not is there a way round it. I just want to put two or more 
> strings in one even if missing values exist. For example,
>  
> obs     Var1     Var2    Var3       Var3
> 1          A        B       K        ABK
> 2                   C                  C
> 3          D               ED        BED
>  
> I have Var1 and Var2 and want to create Var3.
> ----------------------------------------
>  
> Assuming that you want to create var4 from var1, var2, and var3:
>  
>    generate var4 = var1+var2+var3
>  
> You might also want to study:
>  
>    help string functions

*
*   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