<?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: date substitution in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/date-substitution/m-p/642105#M191518</link>
    <description>&lt;P&gt;Actual data helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the &amp;lt;&amp;gt; icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And the complete data step code. You may have other issues. Post the LOG when running the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your DATE2 values do not look like they are in YEAR/MONTH/Day order. They look like DAY MONTH YEAR. The informat YYMMDD expects year month day.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And NULL is right out.&lt;/P&gt;</description>
    <pubDate>Wed, 22 Apr 2020 22:00:54 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-04-22T22:00:54Z</dc:date>
    <item>
      <title>date substitution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-substitution/m-p/642084#M191504</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have a table below looks where i have a Numeric a column(like below date1) which is in YYMMDD10. format&lt;/P&gt;
&lt;P&gt;I would like to update the date1(numeric) column with date2(originally in character,$CHAR10. format) where date1 is blank having the format of date1.&lt;/P&gt;
&lt;P&gt;date1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Numer&amp;nbsp; &amp;nbsp; &amp;nbsp; date2&lt;/P&gt;
&lt;P&gt;2015-10-19&amp;nbsp; 1101&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1102&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;24/12/2005&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1103&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;15/10/2003&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1104&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NULL&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1105&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12/10/2004&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if date2 ~="" and date1=. then date1=input(date2,YYMMDD10.);&lt;/P&gt;
&lt;P&gt;any ideas why the above code doesn't work?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2020 21:05:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-substitution/m-p/642084#M191504</guid>
      <dc:creator>sahoositaram555</dc:creator>
      <dc:date>2020-04-22T21:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: date substitution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-substitution/m-p/642089#M191506</link>
      <description>&lt;P&gt;What do you mean "doesn't work"?? What happens? Show us the log, please (the code in the log, plus the error messages and warning messages, do not chop anything out of the log)&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2020 21:25:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-substitution/m-p/642089#M191506</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-04-22T21:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: date substitution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-substitution/m-p/642105#M191518</link>
      <description>&lt;P&gt;Actual data helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the &amp;lt;&amp;gt; icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And the complete data step code. You may have other issues. Post the LOG when running the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your DATE2 values do not look like they are in YEAR/MONTH/Day order. They look like DAY MONTH YEAR. The informat YYMMDD expects year month day.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And NULL is right out.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2020 22:00:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-substitution/m-p/642105#M191518</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-04-22T22:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: date substitution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-substitution/m-p/642122#M191530</link>
      <description>&lt;P&gt;Sounds like the variable DATE1 has date values, but many are missing.&lt;/P&gt;
&lt;P&gt;Sounds like the variable DATE2 is a character string. And the values look like they are in D-M-Y order.&lt;/P&gt;
&lt;P&gt;To convert DATE2 to a date value use the INPUT() function with the DDMMYY informat.&lt;/P&gt;
&lt;P&gt;To change the value of DATE1 when DATE1 is missing you can use IF/THEN logic or the COALESCE() function.&lt;/P&gt;
&lt;P&gt;Watch out for the values of DATE2 that have the string "NULL".&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
&amp;nbsp;&amp;nbsp;if&amp;nbsp;missing(date1)&amp;nbsp;and&amp;nbsp;upcase(date2)&amp;nbsp;not&amp;nbsp;in&amp;nbsp;('&amp;nbsp;'&amp;nbsp;'NULL')&amp;nbsp;then&amp;nbsp;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;date1&amp;nbsp;=&amp;nbsp;input(date2,ddmmyy10.)
&amp;nbsp;&amp;nbsp;;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2020 23:37:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-substitution/m-p/642122#M191530</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-04-22T23:37:00Z</dc:date>
    </item>
  </channel>
</rss>

