<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to replace a date by a missing value in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-replace-a-date-by-a-missing-value/m-p/623661#M19971</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/306049"&gt;@wottma&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi SAS-Community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a date variable (informat ddmmyy10.) called hctzdate. I am trying to replace one specific date with a missing value (a '.'). In my example I would like to replace the date 03/01/2007.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I do that?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; work.test1_hctz; &lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; work.test_hctz;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; hctzdate =&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;'03jan2007'd&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; hctzdate=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;informat&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; hctzdate &lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;ddmmyy10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There wasn't an error in the log file, however nothing happened when I looked at the data in the viewtable. I am using SAS 9.4. Can anyone help me?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks a lot in advance &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Since we don't have your data, I'm going to guess that hctzdate is really a date/time value and not a date value. Can you show us a few UNformatted values of this variable?&lt;/P&gt;</description>
    <pubDate>Mon, 10 Feb 2020 19:17:52 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-02-10T19:17:52Z</dc:date>
    <item>
      <title>How to replace a date by a missing value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-replace-a-date-by-a-missing-value/m-p/623658#M19970</link>
      <description>&lt;P&gt;Hi SAS-Community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a date variable (informat ddmmyy10.) called hctzdate. I am trying to replace one specific date with a missing value (a '.'). In my example I would like to replace the date 03/01/2007.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I do that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; work.test1_hctz; &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; work.test_hctz;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; hctzdate =&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;'03jan2007'd&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; hctzdate=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;informat&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; hctzdate &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;ddmmyy10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There wasn't an error in the log file, however nothing happened when I looked at the data in the viewtable. I am using SAS 9.4. Can anyone help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot in advance &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 18:53:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-replace-a-date-by-a-missing-value/m-p/623658#M19970</guid>
      <dc:creator>wottma</dc:creator>
      <dc:date>2020-02-10T18:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace a date by a missing value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-replace-a-date-by-a-missing-value/m-p/623661#M19971</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/306049"&gt;@wottma&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi SAS-Community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a date variable (informat ddmmyy10.) called hctzdate. I am trying to replace one specific date with a missing value (a '.'). In my example I would like to replace the date 03/01/2007.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I do that?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; work.test1_hctz; &lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; work.test_hctz;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; hctzdate =&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;'03jan2007'd&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; hctzdate=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;informat&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; hctzdate &lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;ddmmyy10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There wasn't an error in the log file, however nothing happened when I looked at the data in the viewtable. I am using SAS 9.4. Can anyone help me?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks a lot in advance &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Since we don't have your data, I'm going to guess that hctzdate is really a date/time value and not a date value. Can you show us a few UNformatted values of this variable?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 19:17:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-replace-a-date-by-a-missing-value/m-p/623661#M19971</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-02-10T19:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace a date by a missing value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-replace-a-date-by-a-missing-value/m-p/623668#M19973</link>
      <description>&lt;P&gt;In general your code looks correct so are you sure it didn't work?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to look at the type and format, the informat of a variable isn't particularly useful unless you're reading in the data. You should remove your INFORMAT statement or change it to a FORMAT statement. If you do have a datetime as suggested by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp; you can use the DATEPART() function to get just the date for the comparison.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.test1_hctz; 

set work.test_hctz;

if hctzdate ='03JAN2007'd then hctzdate=.;

format hctzdate ddmmyy10.;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/306049"&gt;@wottma&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi SAS-Community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a date variable (informat ddmmyy10.) called hctzdate. I am trying to replace one specific date with a missing value (a '.'). In my example I would like to replace the date 03/01/2007.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I do that?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; work.test1_hctz; &lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; work.test_hctz;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; hctzdate =&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;'03jan2007'd&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; hctzdate=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;informat&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; hctzdate &lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;ddmmyy10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There wasn't an error in the log file, however nothing happened when I looked at the data in the viewtable. I am using SAS 9.4. Can anyone help me?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks a lot in advance &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 19:58:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-replace-a-date-by-a-missing-value/m-p/623668#M19973</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-02-10T19:58:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace a date by a missing value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-replace-a-date-by-a-missing-value/m-p/623674#M19975</link>
      <description>&lt;P&gt;SAS stores dates as the number of days. &lt;STRONG&gt;Perhaps your values are non-integers?&lt;/STRONG&gt;&amp;nbsp; The date formats will ignore the fractional part of the value.&lt;/P&gt;
&lt;PRE&gt;221  data test;
222    do x=.1,.5,.6;
223      date=today()+x;
224      put x= date=comma10.1 +1 date yymmdd10. ;
225    end;
226  run;

x=0.1 date=21,955.1  2020-02-10
x=0.5 date=21,955.5  2020-02-10
x=0.6 date=21,955.6  2020-02-10&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 20:09:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-replace-a-date-by-a-missing-value/m-p/623674#M19975</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-02-10T20:09:43Z</dc:date>
    </item>
  </channel>
</rss>

