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]" <[email protected]>
Subject
Re: st: using outcome of the command "list"
Date
Tue, 20 Aug 2013 00:02:14 -0500
<>
bys IDnumber: replace NewID = IDnumber if _n==1
On Aug 19, 2013, at 11:42 PM, Md Alauddin Majumder <[email protected]> wrote:
>
> Eric, thanks for your reply. Actually I want to fill 'NewID[1]' by Wyoming's IDnumber.
>
> Majumder
>
> ________________________________________
> From: [email protected] [[email protected]] on behalf of Eric A. Booth [[email protected]]
> Sent: Monday, August 19, 2013 11:33 PM
> To: [email protected]
> Subject: Re: st: using outcome of the command "list"
>
> <>
>
> 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/
>
>
>
> *
> * 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/