<?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 do you change a sasdate in a sas datastep? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-do-you-change-a-sasdate-in-a-sas-datastep/m-p/480140#M124059</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/156253"&gt;@mgrzyb&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is a wrong date in the original database.&amp;nbsp;&lt;FONT color="#ff6600"&gt; I don't want to go back to the original database.&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
...&lt;BR /&gt;&lt;BR /&gt;
&lt;P&gt;&lt;STRONG&gt;My code is:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2" face="Courier New" color="#000080"&gt;data&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="2" face="Courier New"&gt; initial;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2" face="Courier New" color="#0000ff"&gt;set&lt;/FONT&gt;&lt;FONT size="2" face="Courier New"&gt; aung.initialdat_mg2;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2" face="Courier New" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;FONT size="2" face="Courier New"&gt; id=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT size="2" face="Courier New" color="#008080"&gt;55&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT size="2" face="Courier New" color="#0000ff"&gt;then&lt;/FONT&gt;&lt;FONT size="2" face="Courier New"&gt; woundvstdate=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT size="2" face="Courier New" color="#008080"&gt;04&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="2" face="Courier New"&gt;/&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT size="2" face="Courier New" color="#008080"&gt;20&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="2" face="Courier New"&gt;/&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT size="2" face="Courier New" color="#008080"&gt;10&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="2" face="Courier New"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;When you type 04/20/10, it is division. You are dividing 04 by 20 and then dividing by 10.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To indicate that 04/20/10 is a date value, use&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if id=55 then woundvstdate='20APR10'D;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 21 Jul 2018 11:50:15 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2018-07-21T11:50:15Z</dc:date>
    <item>
      <title>how do you change a sasdate in a sas datastep?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-you-change-a-sasdate-in-a-sas-datastep/m-p/480138#M124057</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope some one can help me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is a wrong date in the original database.&amp;nbsp;&lt;FONT color="#ff6600"&gt; I don't want to go back to the original database.&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have searched on it in google and at this website and found NO ANSWER.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;&lt;A href="https://communities.sas.com/t5/Base-SAS-Programming/how-to-convert-char-var-to-sas-date/td-p/45067" target="_blank"&gt;https://communities.sas.com/t5/Base-SAS-Programming/how-to-convert-char-var-to-sas-date/td-p/45067&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, here is what the contents of the dataset say for that variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;woundvstdate&lt;/TD&gt;&lt;TD&gt;Num&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;MMDDYY8&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My code is:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;data&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; initial;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; aung.initialdat_mg2;&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; id=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;55&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; woundvstdate=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;04&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;/&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;20&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;/&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;10&lt;/FONT&gt;&lt;/STRONG&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;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;proc&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;print&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;run&lt;/FONT&gt;&lt;/STRONG&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;My outpout is:&lt;/FONT&gt;&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;DIV&gt;&lt;DIV align="center"&gt;Obs id woundvstdate1 &lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;55&lt;/TD&gt;&lt;TD&gt;01/01/60&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Obviously, that is wrong. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;I know there more wrong dates and don't want to keep going back to the original dataset. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;I know this will happen in future endeavors. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT color="#ff6600"&gt;Is there a way to do this in a datastep?&amp;nbsp;&lt;/FONT&gt; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;thank you!&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 21 Jul 2018 11:32:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-you-change-a-sasdate-in-a-sas-datastep/m-p/480138#M124057</guid>
      <dc:creator>mgrzyb</dc:creator>
      <dc:date>2018-07-21T11:32:30Z</dc:date>
    </item>
    <item>
      <title>Re: how do you change a sasdate in a sas datastep?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-you-change-a-sasdate-in-a-sas-datastep/m-p/480140#M124059</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/156253"&gt;@mgrzyb&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is a wrong date in the original database.&amp;nbsp;&lt;FONT color="#ff6600"&gt; I don't want to go back to the original database.&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
...&lt;BR /&gt;&lt;BR /&gt;
&lt;P&gt;&lt;STRONG&gt;My code is:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2" face="Courier New" color="#000080"&gt;data&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="2" face="Courier New"&gt; initial;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2" face="Courier New" color="#0000ff"&gt;set&lt;/FONT&gt;&lt;FONT size="2" face="Courier New"&gt; aung.initialdat_mg2;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2" face="Courier New" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;FONT size="2" face="Courier New"&gt; id=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT size="2" face="Courier New" color="#008080"&gt;55&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT size="2" face="Courier New" color="#0000ff"&gt;then&lt;/FONT&gt;&lt;FONT size="2" face="Courier New"&gt; woundvstdate=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT size="2" face="Courier New" color="#008080"&gt;04&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="2" face="Courier New"&gt;/&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT size="2" face="Courier New" color="#008080"&gt;20&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="2" face="Courier New"&gt;/&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT size="2" face="Courier New" color="#008080"&gt;10&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="2" face="Courier New"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;When you type 04/20/10, it is division. You are dividing 04 by 20 and then dividing by 10.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To indicate that 04/20/10 is a date value, use&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if id=55 then woundvstdate='20APR10'D;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 21 Jul 2018 11:50:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-you-change-a-sasdate-in-a-sas-datastep/m-p/480140#M124059</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-07-21T11:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: how do you change a sasdate in a sas datastep?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-you-change-a-sasdate-in-a-sas-datastep/m-p/480141#M124060</link>
      <description>&lt;P&gt;Thankyou!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That worked.&amp;nbsp; I also&amp;nbsp; tried this, and it seemed to work after&amp;nbsp; I checked out proc contents again.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If there is a difference between the 2, please let know.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; if id=55 then put=(woundvstdate=04/20/10);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again!!!!&lt;/P&gt;</description>
      <pubDate>Sat, 21 Jul 2018 11:51:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-you-change-a-sasdate-in-a-sas-datastep/m-p/480141#M124060</guid>
      <dc:creator>mgrzyb</dc:creator>
      <dc:date>2018-07-21T11:51:11Z</dc:date>
    </item>
    <item>
      <title>Re: how do you change a sasdate in a sas datastep?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-you-change-a-sasdate-in-a-sas-datastep/m-p/480145#M124064</link>
      <description>&lt;P&gt;PROC CONTENTS would not contain information about whether or not&amp;nbsp; changing the value of a variable was successful or not.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;if id=55 then put=(woundvstdate=04/20/10);&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't see how this code would successfully change the value of a variable either.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The bottom line is you have to LOOK at the data set with your own eyes, and see if the value is correct in the data set or not. PROC CONTENTS, and PUT statements don't suffice.&lt;/P&gt;</description>
      <pubDate>Sat, 21 Jul 2018 13:00:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-you-change-a-sasdate-in-a-sas-datastep/m-p/480145#M124064</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-07-21T13:00:29Z</dc:date>
    </item>
  </channel>
</rss>

