Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: extract the value from one cell and past it in another cell (Out of Office Autoreply: [email protected])


From   <[email protected]>
To   <[email protected]>
Subject   Re: st: extract the value from one cell and past it in another cell (Out of Office Autoreply: [email protected])
Date   Fri, 21 Dec 2012 01:04:52 +0000

I am out of the office until Tuesday 8th January 2012.  I shall deal with your enquiry upon my return.  Enjoy the festive season!

Sarah Miller 
Pathways Administrator
------------------------------------------------------
Department of Medical Statistics
London School of Hygiene & Tropical Medicine
Keppel Street
London
WC1E 7HT
http://pathways.lshtm.ac.uk 

>>> "Lingxiang Li" <[email protected]> 12/21/12 01:03 >>>

I am new to Stata and sorry if this problem seems to be too simple. I did my 
search online but failed to find any useful information.

I want to extract the value of one observation from a string variable and 
past it in another cell. (sounds like a Excel manipulation. Anyway, hope you 
get what I mean)

    Var1 (string variable)       Var2
1.    a                                       x
2.    ab
3.    abc                                    z


how do I extract ?abc? from var1?s 3rd observation and past into the 
second observation of var2. so I want it to look like the following graph 
after the command

Var1 (string variable) Var2
1. a                                 x
2. ab                              abc
3. abc                             z

Question: what is the command? (since I want to do this many times in a loop 
fashion, so I cannot manually type: replace var2=?abc? if _n==2)


Thank you very much.

Billy Li 

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index