Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Eric A. Booth" <eric.a.booth@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: using outcome of the command "list" |
Date | Mon, 19 Aug 2013 23:33:42 -0500 |
<> bys IDnumber: replace NewID = IDnumber[1] On Mon, Aug 19, 2013 at 11:23 PM, Md Alauddin Majumder <mm4v@mtmail.mtsu.edu> wrote: > Dear Statalist, > I have a data set like the following: > > IDnumber State NewID > > 1 Alabama . > 2 Alaska . > .. .... ... > .. .... ... > .. .... ... > 52 Wyoming . > > If I input -list IDnumber if State=="Wyoming"-, the outcome will be '52'. Now I want to replace missing value in the first cell of the variable NewID by this outcome. How can I write code for that? > > I tried the following but it did not work: replace NewID[1]=list IDnumber if State=="Wyoming". > > Any help will be greatly appreciated. Thanks in advance. > > > Regards > Majumder > > > * > * 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/