<?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 Code help in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Code-help/m-p/26202#M5963</link>
    <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I have a column with month data.&lt;BR /&gt;
&lt;BR /&gt;
Month&lt;BR /&gt;
200901&lt;BR /&gt;
200811&lt;BR /&gt;
200810&lt;BR /&gt;
;;;;&lt;BR /&gt;
&lt;BR /&gt;
I need to find the maximum of the month column, and date back to 24 months from max month value.&lt;BR /&gt;
&lt;BR /&gt;
In the above example the max month is 200901. I need to take that value and create an array of 23 past months.&lt;BR /&gt;
&lt;BR /&gt;
How to do this in SAS?&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
    <pubDate>Fri, 01 May 2009 18:55:57 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-05-01T18:55:57Z</dc:date>
    <item>
      <title>Code help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Code-help/m-p/26202#M5963</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I have a column with month data.&lt;BR /&gt;
&lt;BR /&gt;
Month&lt;BR /&gt;
200901&lt;BR /&gt;
200811&lt;BR /&gt;
200810&lt;BR /&gt;
;;;;&lt;BR /&gt;
&lt;BR /&gt;
I need to find the maximum of the month column, and date back to 24 months from max month value.&lt;BR /&gt;
&lt;BR /&gt;
In the above example the max month is 200901. I need to take that value and create an array of 23 past months.&lt;BR /&gt;
&lt;BR /&gt;
How to do this in SAS?&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Fri, 01 May 2009 18:55:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Code-help/m-p/26202#M5963</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-05-01T18:55:57Z</dc:date>
    </item>
    <item>
      <title>Re: Code help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Code-help/m-p/26203#M5964</link>
      <description>Using a DATA step, first, convert these character strings to SAS DATE variables using the INPUT function in an assignment statement, then after identifying your maximum value, setup a DO / END loop to iteratate from 1 to 24, as shown below:&lt;BR /&gt;
&lt;BR /&gt;
%LET RANGE = 24;&lt;BR /&gt;
DATA _NULL_;&lt;BR /&gt;
RETAIN MYDATE "&amp;amp;SYSDATE9"D;&lt;BR /&gt;
FORMAT MYDATE DATE9.;&lt;BR /&gt;
ARRAY APDVALS (*) PDVAL1-PDVAL&amp;amp;RANGE;&lt;BR /&gt;
FORMAT PDVAL: YYMMN6.;&lt;BR /&gt;
* now load up the array based on the date var MYDATE. ;&lt;BR /&gt;
DO X = 1 TO &amp;amp;RANGE;&lt;BR /&gt;
  APDVALS(X) = INTNX('MONTH',MYDATE,-X);&lt;BR /&gt;
END;&lt;BR /&gt;
* now show the results to the SASLOG - formatted for effect. ;&lt;BR /&gt;
PUTLOG _ALL_;&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Fri, 01 May 2009 19:03:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Code-help/m-p/26203#M5964</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-05-01T19:03:53Z</dc:date>
    </item>
  </channel>
</rss>

