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: using outcome of the command "list"


From   "Eric A. Booth" <[email protected]>
To   [email protected]
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
<[email protected]> 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/


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