<?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 How can I add 65days to yymmdd column. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-add-65days-to-yymmdd-column/m-p/354701#M83010</link>
    <description>&lt;P&gt;Hi there.&lt;/P&gt;&lt;P&gt;I have a column name 'checkoutday'&lt;/P&gt;&lt;P&gt;Each row has check out day information like&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; checkoutday&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 20160818&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 20160911&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 20160730&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I want to add 65days to each row.&lt;/P&gt;&lt;P&gt;So I tried to add 65days to each row like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data want ;&lt;/P&gt;&lt;P&gt;set From;&lt;/P&gt;&lt;P&gt;wantdate = checkoutday + 65;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data want;&lt;/P&gt;&lt;P&gt;set from;&lt;/P&gt;&lt;P&gt;wantdate = input(checkoutday, yymmdd8.) + 65;&lt;/P&gt;&lt;P&gt;format wantdate yymmd8. ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it didn't work&lt;/P&gt;&lt;P&gt;Any tips or help will be much appreciated.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Sat, 29 Apr 2017 10:27:05 GMT</pubDate>
    <dc:creator>jamie0111</dc:creator>
    <dc:date>2017-04-29T10:27:05Z</dc:date>
    <item>
      <title>How can I add 65days to yymmdd column.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-add-65days-to-yymmdd-column/m-p/354701#M83010</link>
      <description>&lt;P&gt;Hi there.&lt;/P&gt;&lt;P&gt;I have a column name 'checkoutday'&lt;/P&gt;&lt;P&gt;Each row has check out day information like&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; checkoutday&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 20160818&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 20160911&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 20160730&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I want to add 65days to each row.&lt;/P&gt;&lt;P&gt;So I tried to add 65days to each row like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data want ;&lt;/P&gt;&lt;P&gt;set From;&lt;/P&gt;&lt;P&gt;wantdate = checkoutday + 65;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data want;&lt;/P&gt;&lt;P&gt;set from;&lt;/P&gt;&lt;P&gt;wantdate = input(checkoutday, yymmdd8.) + 65;&lt;/P&gt;&lt;P&gt;format wantdate yymmd8. ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it didn't work&lt;/P&gt;&lt;P&gt;Any tips or help will be much appreciated.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Sat, 29 Apr 2017 10:27:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-add-65days-to-yymmdd-column/m-p/354701#M83010</guid>
      <dc:creator>jamie0111</dc:creator>
      <dc:date>2017-04-29T10:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: How can I add 65days to yymmdd column.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-add-65days-to-yymmdd-column/m-p/354702#M83011</link>
      <description>&lt;P&gt;The solution depends on whether checkoutday is a numeric or character variable. If it is numeric this may work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data want;
set from;
wantdate = input(put(checkoutday, 8.), yymmdd8.) + 65;
format wantdate yymmdd8. ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 29 Apr 2017 11:01:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-add-65days-to-yymmdd-column/m-p/354702#M83011</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2017-04-29T11:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: How can I add 65days to yymmdd column.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-add-65days-to-yymmdd-column/m-p/354948#M83096</link>
      <description>&lt;P&gt;Doesn't work is awful vague.&lt;BR /&gt;&lt;BR /&gt;Are there errors in the log: Post the code and log in a code box opened with the {i} to maintain formatting of error messages.&lt;BR /&gt;&lt;BR /&gt;No output? Post any log in a code box.&lt;BR /&gt;&lt;BR /&gt;Unexpected output? Provide input data in the form of a dataset, the actual results and the expected results. Data should be in the form of a data step. Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat&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 {i} 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;However basic understanding needed: INPUT function really wants a character value. Since apparently the value you have is numeric then it needs to be converted to text with Put before using Input per &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt; because SAS will often attempt to do what you want but the default conversion of numeric to text will almost certainly use a BEST format that is incorrect for what you are attempting.&lt;/P&gt;</description>
      <pubDate>Mon, 01 May 2017 14:39:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-add-65days-to-yymmdd-column/m-p/354948#M83096</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-05-01T14:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: How can I add 65days to yymmdd column.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-add-65days-to-yymmdd-column/m-p/354970#M83110</link>
      <description>&lt;P&gt;If your current variable is numeric then you need to first convert it to string before trying to use INPUT() function on it. Otherwise SAS will convert it using the BEST12. format and so you will have four leading spaces that the informat YYMMDD8. will not understand. ' &amp;nbsp; &amp;nbsp;2016' is not a valid value for that informat.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also did you want to put it back into that strange non-date 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 checkoutday @1 daychar $8. ;
cards;
20160818
20160911
20160730
;

data want ;
  set have ;
  wantdate2= input(put(checkoutday,z8.), yymmdd8.) + 65;
  wantdate3= input(daychar, yymmdd8.) + 65;
  format want: yymmdd10. ;
  wantnum = input(put(input(put(checkoutday,z8.),yymmdd8.)+65,yymmddn8.),8.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs    checkoutday    daychar      wantdate2     wantdate3     wantnum
 1       20160818     20160818    2016-10-22    2016-10-22    20161022
 2       20160911     20160911    2016-11-15    2016-11-15    20161115
 3       20160730     20160730    2016-10-03    2016-10-03    20161003&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 May 2017 16:14:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-add-65days-to-yymmdd-column/m-p/354970#M83110</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-05-01T16:14:26Z</dc:date>
    </item>
  </channel>
</rss>

