<?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: Substring to fill date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Substring-to-fill-date/m-p/632795#M187637</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; input(catt("10/15/", SUBSTR(ACADEMIC_PERIOD,1,4)), mmddyy10.)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Maybe something like that?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;May also be worth looking at MDY() function if you want a SAS date?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit - remove the t1 reference since that's only good in SQL&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/5059"&gt;@DavidPhillips2&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;What am I missing in a data step to allow me to use substring to fill the year of a date?&lt;/P&gt;
&lt;PRE&gt;proc sql;
create table test1
(academic_period varchar2(6));
quit;
proc sql;
insert into test1 (academic_period) values ('199910');
quit;
data test1; set test1;
	If SUBSTR(ACADEMIC_PERIOD,5,2) = '10' then somedate = input("10/15%str(SUBSTR(t1.ACADEMIC_PERIOD,1,4)))", mmddyy10.);
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 17 Mar 2020 21:04:25 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2020-03-17T21:04:25Z</dc:date>
    <item>
      <title>Substring to fill date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-to-fill-date/m-p/632794#M187636</link>
      <description>&lt;P&gt;What am I missing in a data step to allow me to use substring to fill the year of a date?&lt;/P&gt;
&lt;PRE&gt;proc sql;
create table test1
(academic_period varchar2(6));
quit;
proc sql;
insert into test1 (academic_period) values ('199910');
quit;
data test1; set test1;
	If SUBSTR(ACADEMIC_PERIOD,5,2) = '10' then somedate = input("10/15%str(SUBSTR(t1.ACADEMIC_PERIOD,1,4)))", mmddyy10.);
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Mar 2020 21:00:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-to-fill-date/m-p/632794#M187636</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2020-03-17T21:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: Substring to fill date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-to-fill-date/m-p/632795#M187637</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; input(catt("10/15/", SUBSTR(ACADEMIC_PERIOD,1,4)), mmddyy10.)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Maybe something like that?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;May also be worth looking at MDY() function if you want a SAS date?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit - remove the t1 reference since that's only good in SQL&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/5059"&gt;@DavidPhillips2&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;What am I missing in a data step to allow me to use substring to fill the year of a date?&lt;/P&gt;
&lt;PRE&gt;proc sql;
create table test1
(academic_period varchar2(6));
quit;
proc sql;
insert into test1 (academic_period) values ('199910');
quit;
data test1; set test1;
	If SUBSTR(ACADEMIC_PERIOD,5,2) = '10' then somedate = input("10/15%str(SUBSTR(t1.ACADEMIC_PERIOD,1,4)))", mmddyy10.);
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Mar 2020 21:04:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-to-fill-date/m-p/632795#M187637</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-03-17T21:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: Substring to fill date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-to-fill-date/m-p/632796#M187638</link>
      <description>&lt;PRE&gt;proc sql;
create table test1
(academic_period varchar2(6));
quit;
proc sql;
insert into test1 (academic_period) values ('199910');
quit;
data test1; set test1;
	format somedate  mmddyy10.;
	If SUBSTR(ACADEMIC_PERIOD,5,2) = '10' then somedate = mdy(10, 15, SUBSTR(ACADEMIC_PERIOD,1,4));
	
run;&lt;/PRE&gt;
&lt;P&gt;This worked.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Mar 2020 21:06:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-to-fill-date/m-p/632796#M187638</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2020-03-17T21:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: Substring to fill date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-to-fill-date/m-p/632798#M187639</link>
      <description>&lt;P&gt;I don't think the MMDDYY informat is going to like a date string that has the letters 'SUBS' in the location where it is expecting the 4 digits of the year.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test1; set test1;
  If SUBSTR(ACADEMIC_PERIOD,5,2) = '10' then 
    somedate = input(cats('10/15/',SUBSTR(ACADEMIC_PERIOD,1,4),mmddyy10.)
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Mar 2020 21:07:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-to-fill-date/m-p/632798#M187639</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-03-17T21:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: Substring to fill date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-to-fill-date/m-p/632800#M187641</link>
      <description>&lt;P&gt;Why not just use the YYMMN informat?&lt;/P&gt;
&lt;PRE&gt;119   data x;
120     x = input('199910',yymmn6.);
121     put x= date9.;
122   run;

x=01OCT1999
&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Mar 2020 21:11:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-to-fill-date/m-p/632800#M187641</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-03-17T21:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: Substring to fill date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-to-fill-date/m-p/632806#M187646</link>
      <description>Depending on what you need to scale to, may be better to go to MDY() function using period as month and day as 15 and year from academic period.</description>
      <pubDate>Tue, 17 Mar 2020 21:32:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-to-fill-date/m-p/632806#M187646</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-03-17T21:32:49Z</dc:date>
    </item>
  </channel>
</rss>

