<?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: Custom Date Format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535435#M147031</link>
    <description>&lt;P&gt;A slightly different take on &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;'s approach:&lt;/P&gt;
&lt;PRE&gt;data custom_fmt_x;
fmtname = 'myDateFmt_x';
type = 'N';
length label $6;
do yr=1960 to 2999;
   start=mdy(1,1,yr);
   end  =mdy(6,30,yr);
   label=cats(yr,'01');
   output;
   start=mdy(7,1,yr);
   end  =mdy(12,31,yr);
   output;
   label=cats(yr,'02');
end;

run;

proc format cntlin=custom_fmt_x;
run;&lt;/PRE&gt;
&lt;P&gt;This is splitting the year at June 30. But if you have&amp;nbsp;a third semester such as a summer session we need to know the boundaries. If they change from year to year then even more fun.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Main difference in my approach is specify a start/end pair for ranges and use more years since each record covers half a year.&lt;/P&gt;</description>
    <pubDate>Wed, 13 Feb 2019 22:09:42 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-02-13T22:09:42Z</dc:date>
    <item>
      <title>Custom Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535353#M146986</link>
      <description>&lt;P&gt;Hi, everyone.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a routine that separates data based on its semester. I need some help creating a custom date format that would&amp;nbsp;output a date in the format YYYYSS (Y = Year, S = Semester), like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;+-----------+---------+
|    DATE   |  OUTPUT |
+-----------+---------+
| 05FEB2018 |  201801 |
| 05AUG2018 |  201802 |&lt;BR /&gt;| 13JAN2019 |  201901 |
+-----------+---------+&lt;/PRE&gt;&lt;P&gt;Can anyone help me?&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Feb 2019 18:37:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535353#M146986</guid>
      <dc:creator>dscamelo</dc:creator>
      <dc:date>2019-02-13T18:37:05Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535358#M146988</link>
      <description>How are semesters defined?</description>
      <pubDate>Wed, 13 Feb 2019 18:47:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535358#M146988</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-02-13T18:47:31Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535362#M146991</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data custom;
do d='01jan2018'd to '31dec2018'd;
m=month(d);
s=put(ceil(m/6),z2.);
length want $6;
want=cats(year(d),s);
output;
end;
format d date9.;
drop m s;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So basically,&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token keyword"&gt;put&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;ceil&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;m&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;6&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;z2&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;want&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;cats&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;year&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;d&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;s&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;should do&lt;/P&gt;</description>
      <pubDate>Wed, 13 Feb 2019 18:58:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535362#M146991</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-02-13T18:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535366#M146993</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt; is there a way to duplicate your logic in proc format instead of placing the desired format into your variable 'want'? From what I found the answer is no. Thoughts on using datastep logic and functions inside proc format? Thanks!</description>
      <pubDate>Wed, 13 Feb 2019 19:05:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535366#M146993</guid>
      <dc:creator>noling</dc:creator>
      <dc:date>2019-02-13T19:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535368#M146994</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/115150"&gt;@noling&lt;/a&gt;&amp;nbsp; &amp;nbsp;First off, Excellent observation!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I personally don't see a need for a custom format as such coz it's only gonna require another pass. The objective is rather straight forward data manipulation. of course, once that's done, one may turn that into a format using&lt;STRONG&gt; cntlin option and store that in a catalog.&lt;/STRONG&gt; I don't see any reason to do all that for this case.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, I can't think of a way to create the OP's custom format , if somebody can, I am all ears&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Feb 2019 19:12:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535368#M146994</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-02-13T19:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535370#M146996</link>
      <description>&lt;P&gt;Hmm something is striking my mind now.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The logic that I applied could perhaps be converted into a user defined function first utilizing &lt;STRONG&gt;proc fcmp&lt;/STRONG&gt; and then I vaguely remember reading somewhere that a function can be used in the values within proc format. But anyway, is it really worth the time and maintenance?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Feb 2019 19:15:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535370#M146996</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-02-13T19:15:25Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535376#M146998</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt; &amp;nbsp; There's some secret to sharpness in the way your brain operates. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Classic!&lt;/P&gt;</description>
      <pubDate>Wed, 13 Feb 2019 19:44:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535376#M146998</guid>
      <dc:creator>Andygray</dc:creator>
      <dc:date>2019-02-13T19:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535380#M147001</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;, thanks for the quick reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a bit confused, but that doesn't seem like it would work for any date, only for 2018. The idea would be to output my data to various tabels e.g. ORDERS_201701, PAYMENTS_201701, SALES_201702 , PAYMENTS_201702, ... , SALES_201901, PAYMENTS_201902.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My idea would be something like: the routine just got called, then the dates that I'm currently processing would be&amp;nbsp;&amp;amp;have. in the following example.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%LET dt_begin_sem	=	%SYSFUNC(INTNX(semiyear,&amp;amp;have.,0,b));
%LET dt_end_sem		=	%SYSFUNC(INTNX(semiyear,&amp;amp;have.,0,e));


&lt;/PRE&gt;&lt;P&gt;Then, whenever a row had its date between the beginning and end of semester, it would be included in the table being currently generated. So table&amp;nbsp;ORDERS_201701 would have everything from 01JAN2017 to 30JUN2017.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another option would be a function that outputted semesters, but I haven't found anything like that.... Comparing the desired function "SMTR" to the existing function "QTR", it would be something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;QTR(15JAN2017) = 1
QTR(20SEP2017) = 3
SMTR(15JAN2017) = 1
SMTR(20SEP2017) = 2&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope I managed to make myself clear, english is not my first language.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Feb 2019 19:57:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535380#M147001</guid>
      <dc:creator>dscamelo</dc:creator>
      <dc:date>2019-02-13T19:57:54Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535384#M147003</link>
      <description>&lt;P&gt;"&lt;SPAN&gt;I'm a bit confused, but that doesn't seem like it would work for any date, only for 2018."&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;That will work for any date. I used the full 2018 year as an example&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;using today as an example&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data w;
d=today();
m=month(d);
s=put(ceil(m/6),z2.);
length want $6;
want=cats(year(d),s);
format d date9.;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Anyways, there seems a bigger objective than just logic.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Ok can you please outline your objective clearly with a sample data and also post a sample out for the input sample explaining what you want to accomplish?&amp;nbsp; Let's do away with bits and pieces. I am unable to exactly guage your need. Also, it would help if you could provide us samples of what you HAVE and what you WANT with some notes&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Feb 2019 20:07:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535384#M147003</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-02-13T20:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535396#M147013</link>
      <description>You still haven't defined what a 'semester' is. We need to know this information to code the formula, specifically which months belong to which semester. Your original example showed two, your latest shows three, the university I went to, had 4.  &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 13 Feb 2019 20:27:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535396#M147013</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-02-13T20:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535411#M147019</link>
      <description>&lt;P&gt;Here's how a format could work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data custom_fmt;
fmtname = 'myDateFmt';
type = 'N';
do start='01jan1990'd to '31dec2018'd;
m=month(start);
s=put(ceil(m/6),z2.);
length label $6;
label=cats(year(start),s);
output;
end;

run;

proc format cntlin=custom_fmt;
run;

proc print data=sashelp.stocks (obs=10);
where stock='IBM';
format date myDateFmt.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Feb 2019 20:45:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535411#M147019</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-02-13T20:45:17Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535429#M147028</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;SMTR(15JAN2017) = 1&lt;BR /&gt;SMTR(20SEP2017) = 2&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why not just test if month &amp;lt; 7?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;smtr=1+month(date)&amp;gt;6;
want=cats(year(date),0,1+month(date)&amp;gt;6));
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Feb 2019 21:50:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535429#M147028</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-02-13T21:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535435#M147031</link>
      <description>&lt;P&gt;A slightly different take on &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;'s approach:&lt;/P&gt;
&lt;PRE&gt;data custom_fmt_x;
fmtname = 'myDateFmt_x';
type = 'N';
length label $6;
do yr=1960 to 2999;
   start=mdy(1,1,yr);
   end  =mdy(6,30,yr);
   label=cats(yr,'01');
   output;
   start=mdy(7,1,yr);
   end  =mdy(12,31,yr);
   output;
   label=cats(yr,'02');
end;

run;

proc format cntlin=custom_fmt_x;
run;&lt;/PRE&gt;
&lt;P&gt;This is splitting the year at June 30. But if you have&amp;nbsp;a third semester such as a summer session we need to know the boundaries. If they change from year to year then even more fun.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Main difference in my approach is specify a start/end pair for ranges and use more years since each record covers half a year.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Feb 2019 22:09:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535435#M147031</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-02-13T22:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535452#M147038</link>
      <description>&lt;P&gt;If you really want to define a format:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc fcmp outlib=WORK.FUNCTIONS.CUSTOM;
  function yyhh(DATE) ;
    return (put(DATE,year4.)||put(ceil(qtr(DATE)/2.1),z2.));
  endsub;
run;

options cmplib=WORK.FUNCTIONS; 

proc format;
  value yyhh (default=6) '01jan1600'd - '01jan20000'd = [yyhh()] 
                         other                        = 'Invalid date';
run;

data _null_;
  YYHH = put('01sep2018'd, yyhh.) ; 
  put YYHH=; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;YYHH=201802&lt;/P&gt;
&lt;P&gt;Personally, I'd create the format as 2018H2 to avoid any confusion with months or quarters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Feb 2019 23:23:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535452#M147038</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-02-13T23:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535466#M147045</link>
      <description>&lt;P&gt;Ha, I wanted to show off and support 5-digit years but forgot bits here and there...&lt;/P&gt;
&lt;P&gt;This works even better:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc fcmp outlib=WORK.FUNCTIONS.CUSTOM;
  function yyhh(DATE) ;
    return (put(DATE,year5.)||put(ceil(qtr(DATE)/2.1),z2.));
  endsub;
run;

options cmplib=WORK.FUNCTIONS; 

proc format;
  value yyhh (default=6) '01jan1600'd - '01jan20000'd = [yyhh()] 
                         other                        = 'NoDate';
run;

data _null_;
  YYHH = put('01sep12018'd, yyhh7.) ; 
  put YYHH=; 
  YYHH = put('01sep2018'd, yyhh.) ; 
  put YYHH=; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;YYHH=1201802&lt;BR /&gt;YYHH=201802&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Feb 2019 00:40:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535466#M147045</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-02-14T00:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535546#M147077</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;, the one that has 3 was a quarter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The word semester means "six months", and that is what I am going for.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Feb 2019 11:02:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535546#M147077</guid>
      <dc:creator>dscamelo</dc:creator>
      <dc:date>2019-02-14T11:02:56Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535549#M147079</link>
      <description>&lt;P&gt;Sure, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is something like this...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* This would be any date I need to separate data from */
%LET date_routine = %SYSFUNC(MDY(1,1,1992)); 

%LET semester_begin	= %SYSFUNC(INTNX(semiyear,&amp;amp;date_routine.,0,b));
%LET semester_end	= %SYSFUNC(INTNX(semiyear,&amp;amp;date_routine.,0,e));

/* This is the what I need, a way to quickly format the date by semester, without casting a sequence of strings*/
%LET formatted = %SYSFUNC(PUTN(&amp;amp;semester_begin.,yymmn6.));

PROC SQL;
	CREATE TABLE RETAIL_&amp;amp;formatted. AS
	SELECT
		*
	FROM
		sashelp.retail AS r
	WHERE
		r.date BETWEEN &amp;amp;semester_begin. AND &amp;amp;semester_end.;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Obviously, the "formatted" variable would be outputted to year and month, instead of year and semester. What I would need is something like the format YYMMn6, but instead a YY"SS"n6.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I need should have been fairly simple, except that format doesn't exist. So I was trying to create it myself, but needed help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have I made it clearer?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again for trying to help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Feb 2019 11:18:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535549#M147079</guid>
      <dc:creator>dscamelo</dc:creator>
      <dc:date>2019-02-14T11:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535554#M147084</link>
      <description>&lt;P&gt;That worked! Thank you, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt; !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And thanks again to everyone who tried to help, especially &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;!&lt;/P&gt;</description>
      <pubDate>Thu, 14 Feb 2019 11:48:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Custom-Date-Format/m-p/535554#M147084</guid>
      <dc:creator>dscamelo</dc:creator>
      <dc:date>2019-02-14T11:48:11Z</dc:date>
    </item>
  </channel>
</rss>

