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: Mvdecode Problem
From
Nick Cox <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: Mvdecode Problem
Date
Fri, 23 Aug 2013 16:12:25 +0100
I should have said: Good question (assuming that is correct).
But now I find that I can't reproduce it. So, please show us the evidence.
. clear
. set obs 10
obs was 0, now 10
. gen age = -10 + _n
. l
+-----+
| age |
|-----|
1. | -9 |
2. | -8 |
3. | -7 |
4. | -6 |
5. | -5 |
|-----|
6. | -4 |
7. | -3 |
8. | -2 |
9. | -1 |
10. | 0 |
+-----+
. mvdecode age, mv(0/-9)
age: 10 missing values generated
. l
+-----+
| age |
|-----|
1. | . |
2. | . |
3. | . |
4. | . |
5. | . |
|-----|
6. | . |
7. | . |
8. | . |
9. | . |
10. | . |
+-----+
Nick
[email protected]
On 23 August 2013 15:56, James Jensen <[email protected]> wrote:
> Thanks nick.
>
> I am still not sure why when I used mvdecode age, mv(0/-9) the -9 did not become missing and it is only when I used mvdecode age, mv(-9) the -9 then became missing?
>
>
>
>
> ----- Original Message -----
> From: Nick Cox <[email protected]>
> To: "[email protected]" <[email protected]>
> Cc:
> Sent: Friday, 23 August 2013, 15:36
> Subject: Re: st: Mvdecode Problem
>
> It shouldn't make a difference. Both forms are valid numlists.
>
> . numlist "0/-9"
>
> . ret li
>
> macros:
> r(numlist) : "0 -1 -2 -3 -4 -5 -6 -7 -8 -9"
>
> . numlist "-9/0"
>
> . ret li
>
> macros:
> r(numlist) : "-9 -8 -7 -6 -5 -4 -3 -2 -1 0"
>
> Notice that whenever you have issued the first command, the second
> command is redundant and won't undo recoding of zeros to missing.
>
> Nick
> [email protected]
>
>
> On 23 August 2013 15:27, James Jensen <[email protected]> wrote:
>> Hi all,
>>
>> I want to code whatever negative or zero in the dataset to missing.
>>
>> If I use mvdecode _all, mv(0/-9) or mvdecode _all, mv(-9/0)
>>
>> Then I notice when I used mvdecode _all, mv(0/-9) , the -9 did not become missing.
>>
>> The second thing is that I want to recode whatever negative to missing.
>>
>> If I use mvdecode _all, mv(-1/-9) or mvdecode _all, mv(-9/-1)
>>
>> Would it make a difference whichever way I put the -1 or -9 first?
>>
>>
>> *
>> * 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/