<?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: Adding days to a month format and changing format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Adding-days-to-a-month-format-and-changing-format/m-p/564748#M158441</link>
    <description>&lt;P&gt;Assuming that dod is a numeric variable&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input dod;
datalines;
201705
201304
201709
201608
;

data want;
   set have;
   dod_formatted=input(put(dod, best6.), yymmn6.);
   format dod_formatted yymmdd10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 09 Jun 2019 13:18:01 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2019-06-09T13:18:01Z</dc:date>
    <item>
      <title>Adding days to a month format and changing format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-days-to-a-month-format-and-changing-format/m-p/564746#M158440</link>
      <description>&lt;P&gt;I have a variable, dod, that contains the date of death as yearmo and does not contain days. How do I add the first of every month (01) to the end of every case in the dod column and then change the format to match year-mo-da?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an example of the data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dod&lt;/P&gt;&lt;P&gt;201705&lt;/P&gt;&lt;P&gt;201304&lt;/P&gt;&lt;P&gt;201709&lt;/P&gt;&lt;P&gt;201608&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once I add the days as 01 to every case, how do I chance to the below format?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dod_formatted&lt;/P&gt;&lt;P&gt;2017-05-01&lt;/P&gt;&lt;P&gt;2013-04-01&lt;/P&gt;&lt;P&gt;2017-09-01&lt;/P&gt;&lt;P&gt;2016-08-01&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jun 2019 12:30:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-days-to-a-month-format-and-changing-format/m-p/564746#M158440</guid>
      <dc:creator>dwhitney</dc:creator>
      <dc:date>2019-06-09T12:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: Adding days to a month format and changing format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-days-to-a-month-format-and-changing-format/m-p/564748#M158441</link>
      <description>&lt;P&gt;Assuming that dod is a numeric variable&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input dod;
datalines;
201705
201304
201709
201608
;

data want;
   set have;
   dod_formatted=input(put(dod, best6.), yymmn6.);
   format dod_formatted yymmdd10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 09 Jun 2019 13:18:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-days-to-a-month-format-and-changing-format/m-p/564748#M158441</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-06-09T13:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: Adding days to a month format and changing format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-days-to-a-month-format-and-changing-format/m-p/564753#M158445</link>
      <description>&lt;P&gt;dod (should be "ymdod", sorry) is a numeric value. The data I have contains over 11 million cases. New to SAS coding. Is there a way to bypass the first set of code to avoid entering in the raw data using the "datalines" step?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I did with your code, but it is not working. The error message is below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;set have;&lt;/P&gt;&lt;P&gt;input ymdod;&lt;BR /&gt;ymdod_formatted=input(put(ymdod, best6.), yymmn6.);&lt;BR /&gt;format ymdod_formatted yymmdd10.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR 48-59: The format $BEST was not found or could not be loaded.&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jun 2019 14:43:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-days-to-a-month-format-and-changing-format/m-p/564753#M158445</guid>
      <dc:creator>dwhitney</dc:creator>
      <dc:date>2019-06-09T14:43:23Z</dc:date>
    </item>
    <item>
      <title>Re: Adding days to a month format and changing format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-days-to-a-month-format-and-changing-format/m-p/564754#M158446</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/241840"&gt;@dwhitney&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please remove the input statement, since you are using the set statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anushree&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jun 2019 15:30:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-days-to-a-month-format-and-changing-format/m-p/564754#M158446</guid>
      <dc:creator>anushreebiotech</dc:creator>
      <dc:date>2019-06-09T15:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: Adding days to a month format and changing format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-days-to-a-month-format-and-changing-format/m-p/564755#M158447</link>
      <description>&lt;P&gt;What is the name of your dataset? Then insert that instead of "have" in the Set Statement. Also, you don't need the Input Statement. I suspect, this will give you what you want&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set have;
   ymdod_formatted=input(put(ymdod, best6.), yymmn6.);
   format ymdod_formatted yymmdd10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 09 Jun 2019 15:31:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-days-to-a-month-format-and-changing-format/m-p/564755#M158447</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-06-09T15:31:39Z</dc:date>
    </item>
    <item>
      <title>Re: Adding days to a month format and changing format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-days-to-a-month-format-and-changing-format/m-p/564766#M158448</link>
      <description>&lt;P&gt;Based on the error message you posted, I suspect you are wrong concerning one key item.&amp;nbsp; I suspect that YMDOD is actually a character variable that happens to contain digits, not a numeric variable.&amp;nbsp; A PROC CONTENTS would reveal that.&amp;nbsp; If that's the case, you need a simpler, slightly different solution:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set have;
   ymdod_formatted = input(ymdod, yymmn6.);
   format ymdod_formatted yymmdd10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 09 Jun 2019 17:42:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-days-to-a-month-format-and-changing-format/m-p/564766#M158448</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-06-09T17:42:36Z</dc:date>
    </item>
    <item>
      <title>Re: Adding days to a month format and changing format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-days-to-a-month-format-and-changing-format/m-p/564768#M158450</link>
      <description>&lt;P&gt;You are correct! It was in the character format. Thanks so much! The code worked great!&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jun 2019 17:54:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-days-to-a-month-format-and-changing-format/m-p/564768#M158450</guid>
      <dc:creator>dwhitney</dc:creator>
      <dc:date>2019-06-09T17:54:51Z</dc:date>
    </item>
  </channel>
</rss>

