blank variable if value is 0 help

  • Follow


Hi,


I have a numeric variable and I want to make it blank (i.e. missing)
if the value is zero. Please could someone show me how to do this. I'm
sure there is a simple way but I can't find it!
0
Reply chris12345 1/5/2010 10:15:11 AM

On Jan 5, 5:15=A0am, chris12345 <chrisloon...@googlemail.com> wrote:
> Hi,
>
> I have a numeric variable and I want to make it blank (i.e. missing)
> if the value is zero. Please could someone show me how to do this. I'm
> sure there is a simple way but I can't find it!

Why do you want to convert 0 to SYSMIS?  It is usually better practice
to use user-defined missing values.  To make 0 a user-defined missing
value, run this command (replacing MyVar with the name of your
variable):

missing values MyVar (0).

--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/Home
"When all else fails, RTFM."
0
Reply Bruce 1/5/2010 12:14:29 PM


On Tue, 5 Jan 2010 04:14:29 -0800 (PST), Bruce Weaver
<bweaver@lakeheadu.ca> wrote:

>On Jan 5, 5:15�am, chris12345 <chrisloon...@googlemail.com> wrote:
>> Hi,
>>
>> I have a numeric variable and I want to make it blank (i.e. missing)
>> if the value is zero. Please could someone show me how to do this. I'm
>> sure there is a simple way but I can't find it!
>
>Why do you want to convert 0 to SYSMIS?  It is usually better practice
>to use user-defined missing values.  To make 0 a user-defined missing
>value, run this command (replacing MyVar with the name of your
>variable):
>
>missing values MyVar (0).


The one place that I like to have the 'dot'  show up for missing
is when I am listing data for eyeballing what is there.

I think this does it, 

Recode  Myvar(0=sysmis).

-- 
Rich Ulrich 
0
Reply Rich 1/5/2010 7:08:39 PM

On Jan 5, 2:08=A0pm, Rich Ulrich <rich.ulr...@comcast.net> wrote:
> On Tue, 5 Jan 2010 04:14:29 -0800 (PST), Bruce Weaver
>
> <bwea...@lakeheadu.ca> wrote:
> >On Jan 5, 5:15=A0am, chris12345 <chrisloon...@googlemail.com> wrote:
> >> Hi,
>
> >> I have a numeric variable and I want to make it blank (i.e. missing)
> >> if the value is zero. Please could someone show me how to do this. I'm
> >> sure there is a simple way but I can't find it!
>
> >Why do you want to convert 0 to SYSMIS? =A0It is usually better practice
> >to use user-defined missing values. =A0To make 0 a user-defined missing
> >value, run this command (replacing MyVar with the name of your
> >variable):
>
> >missing values MyVar (0).
>
> The one place that I like to have the 'dot' =A0show up for missing
> is when I am listing data for eyeballing what is there.


Yes, that kind of visibility can be useful.  To achieve it with user-
defined missing values, I sometimes choose a value with more digits
than the valid values.  E.g., for a variable with single-digit valid
values, I might use 99 or 999 as my user-defined missing value.

>
> I think this does it,
>
> Recode =A0Myvar(0=3Dsysmis).
>

--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/Home
"When all else fails, RTFM."
0
Reply Bruce 1/5/2010 9:32:58 PM

This is a multi-part message in MIME format.
--------------050301000401030002030300
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit


If all of the numbers are non negative using negative values for user 
missing also facilitates eyeballing.
It also can allow you to differentiate reasons for having a missing 
value you can have
missing values myvar (lo thru -1).
-1 'result was zero'
-2 'interviewer accidentally skipped q'
-3 'respondent stopped responding'
-4 'page blank from printer'
-5 'respondent was pattern answering'
-6 'legitimate skip'.

recode myvar (0=-1) (else = copy) into mynewvar.
or
recode myvar (0=-9999) (else = copy) into mynewvar.
missing values myvar (lo thru -1).

For quality control, I strongly recommend reserving system missing for 
instances where the system cannot follow your instructions.  This allows 
you to go back and correct your instructions or at least add comments to 
the instructions saying why you did not give more instruction that 
provided for special instances.

Art Kendall
Social Research Consultants


Bruce Weaver wrote:
> On Jan 5, 2:08 pm, Rich Ulrich <rich.ulr...@comcast.net> wrote:
>   
>> On Tue, 5 Jan 2010 04:14:29 -0800 (PST), Bruce Weaver
>>
>> <bwea...@lakeheadu.ca> wrote:
>>     
>>> On Jan 5, 5:15 am, chris12345 <chrisloon...@googlemail.com> wrote:
>>>       
>>>> Hi,
>>>>         
>>>> I have a numeric variable and I want to make it blank (i.e. missing)
>>>> if the value is zero. Please could someone show me how to do this. I'm
>>>> sure there is a simple way but I can't find it!
>>>>         
>>> Why do you want to convert 0 to SYSMIS?  It is usually better practice
>>> to use user-defined missing values.  To make 0 a user-defined missing
>>> value, run this command (replacing MyVar with the name of your
>>> variable):
>>>       
>>> missing values MyVar (0).
>>>       
>> The one place that I like to have the 'dot'  show up for missing
>> is when I am listing data for eyeballing what is there.
>>     
>
>
> Yes, that kind of visibility can be useful.  To achieve it with user-
> defined missing values, I sometimes choose a value with more digits
> than the valid values.  E.g., for a variable with single-digit valid
> values, I might use 99 or 999 as my user-defined missing value.
>
>   
>> I think this does it,
>>
>> Recode  Myvar(0=sysmis).
>>
>>     
>
> --
> Bruce Weaver
> bweaver@lakeheadu.ca
> http://sites.google.com/a/lakeheadu.ca/bweaver/Home
> "When all else fails, RTFM."
>   

--------------050301000401030002030300
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
If all of the numbers are non negative using negative values for user
missing also facilitates eyeballing.<br>
It also can allow you to differentiate reasons for having a missing
value you can have <br>
missing values myvar (lo thru -1).<br>
-1 'result was zero'<br>
-2 'interviewer accidentally skipped q'<br>
-3 'respondent stopped responding'<br>
-4 'page blank from printer' <br>
-5 'respondent was pattern answering'<br>
-6 'legitimate skip'.<br>
<br>
recode myvar (0=-1) (else = copy) into mynewvar.<br>
or <br>
recode myvar (0=-9999) (else = copy) into mynewvar.<br>
missing values myvar (lo thru -1).<br>
<br>
For quality control, I strongly recommend reserving system missing for
instances where the system cannot follow your instructions.&nbsp; This
allows you to go back and correct your instructions or at least add
comments to the instructions saying why you did not give more
instruction that provided for special instances.<br>
<br>
Art Kendall<br>
Social Research Consultants<br>
<br>
<br>
Bruce Weaver wrote:
<blockquote
 cite="mid:d8b8e0f9-ae85-45f2-9c32-dd5bfb6de2af@j4g2000yqe.googlegroups.com"
 type="cite">
  <pre wrap="">On Jan 5, 2:08&nbsp;pm, Rich Ulrich <a class="moz-txt-link-rfc2396E" href="mailto:rich.ulr...@comcast.net">&lt;rich.ulr...@comcast.net&gt;</a> wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">On Tue, 5 Jan 2010 04:14:29 -0800 (PST), Bruce Weaver

<a class="moz-txt-link-rfc2396E" href="mailto:bwea...@lakeheadu.ca">&lt;bwea...@lakeheadu.ca&gt;</a> wrote:
    </pre>
    <blockquote type="cite">
      <pre wrap="">On Jan 5, 5:15&nbsp;am, chris12345 <a class="moz-txt-link-rfc2396E" href="mailto:chrisloon...@googlemail.com">&lt;chrisloon...@googlemail.com&gt;</a> wrote:
      </pre>
      <blockquote type="cite">
        <pre wrap="">Hi,
        </pre>
      </blockquote>
    </blockquote>
    <blockquote type="cite">
      <blockquote type="cite">
        <pre wrap="">I have a numeric variable and I want to make it blank (i.e. missing)
if the value is zero. Please could someone show me how to do this. I'm
sure there is a simple way but I can't find it!
        </pre>
      </blockquote>
    </blockquote>
    <blockquote type="cite">
      <pre wrap="">Why do you want to convert 0 to SYSMIS? &nbsp;It is usually better practice
to use user-defined missing values. &nbsp;To make 0 a user-defined missing
value, run this command (replacing MyVar with the name of your
variable):
      </pre>
    </blockquote>
    <blockquote type="cite">
      <pre wrap="">missing values MyVar (0).
      </pre>
    </blockquote>
    <pre wrap="">The one place that I like to have the 'dot' &nbsp;show up for missing
is when I am listing data for eyeballing what is there.
    </pre>
  </blockquote>
  <pre wrap=""><!---->

Yes, that kind of visibility can be useful.  To achieve it with user-
defined missing values, I sometimes choose a value with more digits
than the valid values.  E.g., for a variable with single-digit valid
values, I might use 99 or 999 as my user-defined missing value.

  </pre>
  <blockquote type="cite">
    <pre wrap="">I think this does it,

Recode &nbsp;Myvar(0=sysmis).

    </pre>
  </blockquote>
  <pre wrap=""><!---->
--
Bruce Weaver
<a class="moz-txt-link-abbreviated" href="mailto:bweaver@lakeheadu.ca">bweaver@lakeheadu.ca</a>
<a class="moz-txt-link-freetext" href="http://sites.google.com/a/lakeheadu.ca/bweaver/Home">http://sites.google.com/a/lakeheadu.ca/bweaver/Home</a>
"When all else fails, RTFM."
  </pre>
</blockquote>
</body>
</html>

--------------050301000401030002030300--
0
Reply Art 1/6/2010 1:15:32 PM

4 Replies
753 Views

(page loaded in 0.073 seconds)

Similiar Articles:













7/22/2012 10:30:02 AM


Reply: