<?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: repace day 01 with day 15 in date variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/repace-day-01-with-day-15-in-date-variable/m-p/240344#M44312</link>
    <description>&lt;P&gt;It's important to understand what the variable actually contains.&amp;nbsp; From&amp;nbsp; your description, it looks like it is a numeric date-time variable.&amp;nbsp; If so, this will convert it to the proper date, while moving from the 1st to the 15th:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;birth_info = datepart(birth_info) + 14;&lt;/P&gt;
&lt;P&gt;format birth_info yymmdd10.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After this, you will have a date variable (no longer date-time).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try printing a few records after making the change, and see if the results look right.&amp;nbsp; If they're not right, we'll have to get a better handle on what the variable actually contains (results from PROC CONTENTS, results from PROC PRINT with all formats removed).&lt;/P&gt;</description>
    <pubDate>Mon, 21 Dec 2015 22:02:28 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2015-12-21T22:02:28Z</dc:date>
    <item>
      <title>repace day 01 with day 15 in date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/repace-day-01-with-day-15-in-date-variable/m-p/240340#M44309</link>
      <description>&lt;P&gt;Hello, everyone&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My variable birth_info has yyyy-mm format, and when I imported it into SAS, it was automatically converted to 01MMYY 00:00:00 format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to control the import format?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I actually want to use 15th of the month instead of the 1st day of the month as the day to calculate the ages. What is the easy way to replace all "01"s in the 01MMYY new date to "15"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2015 21:53:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/repace-day-01-with-day-15-in-date-variable/m-p/240340#M44309</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2015-12-21T21:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: repace day 01 with day 15 in date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/repace-day-01-with-day-15-in-date-variable/m-p/240341#M44310</link>
      <description>intnx the variable.&lt;BR /&gt;&lt;BR /&gt;new_var=intnx('day', variable, 15);</description>
      <pubDate>Mon, 21 Dec 2015 21:54:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/repace-day-01-with-day-15-in-date-variable/m-p/240341#M44310</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-12-21T21:54:50Z</dc:date>
    </item>
    <item>
      <title>Re: repace day 01 with day 15 in date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/repace-day-01-with-day-15-in-date-variable/m-p/240344#M44312</link>
      <description>&lt;P&gt;It's important to understand what the variable actually contains.&amp;nbsp; From&amp;nbsp; your description, it looks like it is a numeric date-time variable.&amp;nbsp; If so, this will convert it to the proper date, while moving from the 1st to the 15th:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;birth_info = datepart(birth_info) + 14;&lt;/P&gt;
&lt;P&gt;format birth_info yymmdd10.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After this, you will have a date variable (no longer date-time).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try printing a few records after making the change, and see if the results look right.&amp;nbsp; If they're not right, we'll have to get a better handle on what the variable actually contains (results from PROC CONTENTS, results from PROC PRINT with all formats removed).&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2015 22:02:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/repace-day-01-with-day-15-in-date-variable/m-p/240344#M44312</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-12-21T22:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: repace day 01 with day 15 in date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/repace-day-01-with-day-15-in-date-variable/m-p/240348#M44316</link>
      <description>Thank you for the quick reply.&lt;BR /&gt;It works and I got the age correctly. &lt;BR /&gt;</description>
      <pubDate>Mon, 21 Dec 2015 22:07:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/repace-day-01-with-day-15-in-date-variable/m-p/240348#M44316</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2015-12-21T22:07:54Z</dc:date>
    </item>
    <item>
      <title>Re: repace day 01 with day 15 in date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/repace-day-01-with-day-15-in-date-variable/m-p/240349#M44317</link>
      <description>Yes, 14 is the number to use if I want to replace with 15. Below are my codes:&lt;BR /&gt;     new_birth=intnx('day', datepart(Birth_info), 15);&lt;BR /&gt;	 age = round(yrdif(new_birth, datepart(Registration_Time),'AGE'),0.1);&lt;BR /&gt;   format new_birth mmddyy10.;</description>
      <pubDate>Mon, 21 Dec 2015 22:09:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/repace-day-01-with-day-15-in-date-variable/m-p/240349#M44317</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2015-12-21T22:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: repace day 01 with day 15 in date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/repace-day-01-with-day-15-in-date-variable/m-p/240350#M44318</link>
      <description>&lt;P&gt;You'll have to see which code gives you the right result.&amp;nbsp; I don't think that my answer and Reeza's answer are compatible (although I could be proven wrong).&amp;nbsp; I assumed you had a date-time, and I think Reeza assumed you had a date.&amp;nbsp; So check the results and see which one is working properly.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2015 22:12:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/repace-day-01-with-day-15-in-date-variable/m-p/240350#M44318</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-12-21T22:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: repace day 01 with day 15 in date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/repace-day-01-with-day-15-in-date-variable/m-p/240352#M44320</link>
      <description>In my .csv file I have yyyy-mm format date variable, and when I imported into SAS, it became 01MMYY 00:00:00 format. &lt;BR /&gt;&lt;BR /&gt;I got the ideas from both of you so I think I am okay. Thank you again!</description>
      <pubDate>Mon, 21 Dec 2015 22:16:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/repace-day-01-with-day-15-in-date-variable/m-p/240352#M44320</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2015-12-21T22:16:07Z</dc:date>
    </item>
  </channel>
</rss>

