Statalist


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

RE: st: Placing the content of 3 cells in 1 new cell?


From   "Carter Rees" <carterrees@gmail.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Placing the content of 3 cells in 1 new cell?
Date   Mon, 5 Nov 2007 07:56:54 -0500

Nick Cox's -catenate- automates the generate command suggested by Svend.

ssc install catenate

catenate Drugs = Drug1 Drug2 Drug3, p(/)



Carter


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Svend Juul
Sent: Monday, November 05, 2007 7:12 AM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: Placing the content of 3 cells in 1 new cell? 


Ziad wrote:

In Excel the person can have the content of 3 other cells in one cell,
for example

Drug1        Drug2         Drug3         Drugs
--------------------------------------------------------------
Panad        Asp          Val            Panad/Asp/Val

by typing:
drugs=drug1&"/"&drug2&"/"drug3

Is it possible to do something similar in STATA?

-----------------------------------------------------------------

yes:
   generate drugs = drug1 + "/" + drug2 + "/" + drug3
or: 
   egen drugs = concat(drug1-drug3), punct(/)

Svend
__________________________________________

Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000  Aarhus C, Denmark
Phone: +45 8942 6090
Home:  +45 8693 7796
Email: sj@soci.au.dk
__________________________________________ 

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



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