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]

From |
"Sarah Edgington" <sedging@ucla.edu> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: extract the value from one cell and past it in another cell |

Date |
Thu, 20 Dec 2012 17:42:47 -0800 |

I think you've simplified your example too far for it to be clear what you actually want to do. Under what circumstances do you want to make the substitution? I could make some guesses based on your example, but they'd be nothing more than guesses. If you can explain what rules you want to use to decide what cell to extract values from and which cells to copy those values to, we can probably help you figure out how to write the code. -Sarah -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Lingxiang Li Sent: Thursday, December 20, 2012 5:04 PM To: statalist@hsphsun2.harvard.edu Subject: st: extract the value from one cell and past it in another cell 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/

**References**:**st: extract the value from one cell and past it in another cell***From:*"Lingxiang Li" <lil7rpi@gmail.com>

- Prev by Date:
**st: extract the value from one cell and past it in another cell** - Next by Date:
**Re: st: RE: extract the value from one cell and past it in another cell (Out of Office Autoreply: sarah.miller@lshtm.ac.uk)** - Previous by thread:
**st: extract the value from one cell and past it in another cell** - Next by thread:
**Re: st: RE: extract the value from one cell and past it in another cell (Out of Office Autoreply: sarah.miller@lshtm.ac.uk)** - Index(es):