<?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: extracting month wise data in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/extracting-month-wise-data/m-p/39271#M10116</link>
    <description>You can use the INTNX function in your SELECT statement along with your constant value of the month-start-date.  The INTNX function can decrement/increment different SAS variable values - check the DOC for details.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
SAS Language Reference: Dictionary, INTNX Function&lt;BR /&gt;
&lt;BR /&gt;
Increments a date, time, or datetime value by a given time interval, and returns a date, time, or datetime value. &lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a000212700.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a000212700.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search argument:&lt;BR /&gt;
&lt;BR /&gt;
proc sql select date intnx site:sas.com</description>
    <pubDate>Tue, 12 Jan 2010 00:54:54 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2010-01-12T00:54:54Z</dc:date>
    <item>
      <title>extracting month wise data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/extracting-month-wise-data/m-p/39270#M10115</link>
      <description>Hi Friends&lt;BR /&gt;
&lt;BR /&gt;
How do i extract month wise data from a table. Here's my code:&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
&lt;BR /&gt;
%Let Load_date = '01NOV2009'd;&lt;BR /&gt;
&lt;BR /&gt;
Select 	DATEPART(PARAM_DATE_LOW)&lt;BR /&gt;
into 	:Load_date&lt;BR /&gt;
From 	param_table&lt;BR /&gt;
Where 	PARAM_ID = 'TABLE1';&lt;BR /&gt;
&lt;BR /&gt;
/*Store Source Record count to load*/&lt;BR /&gt;
&lt;BR /&gt;
Select 	count(*) into :src_rec_count &lt;BR /&gt;
From 	source_table src&lt;BR /&gt;
Where 	data_column = &amp;amp;Load_date&lt;BR /&gt;
&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
let's say PARAM_DATE_LOW has vlaue 01-Nov-09. In this 2nd select statement, I want only november month's data from source_table.&lt;BR /&gt;
&lt;BR /&gt;
How can I achieve that?&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Tue, 12 Jan 2010 00:03:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/extracting-month-wise-data/m-p/39270#M10115</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-01-12T00:03:02Z</dc:date>
    </item>
    <item>
      <title>Re: extracting month wise data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/extracting-month-wise-data/m-p/39271#M10116</link>
      <description>You can use the INTNX function in your SELECT statement along with your constant value of the month-start-date.  The INTNX function can decrement/increment different SAS variable values - check the DOC for details.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
SAS Language Reference: Dictionary, INTNX Function&lt;BR /&gt;
&lt;BR /&gt;
Increments a date, time, or datetime value by a given time interval, and returns a date, time, or datetime value. &lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a000212700.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a000212700.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search argument:&lt;BR /&gt;
&lt;BR /&gt;
proc sql select date intnx site:sas.com</description>
      <pubDate>Tue, 12 Jan 2010 00:54:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/extracting-month-wise-data/m-p/39271#M10116</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-01-12T00:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: extracting month wise data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/extracting-month-wise-data/m-p/39272#M10117</link>
      <description>If I got this right, you want to extract data from some table based on a specified month which is extracted from a parameter table. Well, you have at least two ways of doing this, both of them based on matching transformed dates.&lt;BR /&gt;
&lt;BR /&gt;
The simple one would be to match numeric month/year:&lt;BR /&gt;
[pre]&lt;BR /&gt;
%Let Load_date = '01NOV2009'd;&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
select datepart(PARAM_DATE_LOW)&lt;BR /&gt;
into :LOAD_DATE&lt;BR /&gt;
from param_table&lt;BR /&gt;
where PARAM_ID = 'TABLE1';&lt;BR /&gt;
&lt;BR /&gt;
select count(*) into :SRC_REC_COUNT from SOURCE_TABLE_SRC&lt;BR /&gt;
where month(data_column) = month(&amp;amp;LOAD_DATE) and&lt;BR /&gt;
year(data_column) = year(&amp;amp;LOAD_DATE);&lt;BR /&gt;
quit;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
The other one would be to match alphas with the formatted date:&lt;BR /&gt;
[pre]&lt;BR /&gt;
%Let Load_date = '01NOV2009'd;&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
select datepart(PARAM_DATE_LOW)&lt;BR /&gt;
into :LOAD_DATE&lt;BR /&gt;
from param_table&lt;BR /&gt;
where PARAM_ID = 'TABLE1';&lt;BR /&gt;
&lt;BR /&gt;
select count(*) into :SRC_REC_COUNT from SOURCE_TABLE_SRC&lt;BR /&gt;
where strip(put(DATA_COLUM,yymon6.))=&lt;BR /&gt;
(select strip(put(datepart(PARAM_DATE_LOW),yymon6.))&lt;BR /&gt;
from param_table&lt;BR /&gt;
where PARAM_ID = 'TABLE1');&lt;BR /&gt;
quit;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Code above &lt;U&gt;not tested&lt;/U&gt;.&lt;BR /&gt;
&lt;BR /&gt;
Cheers from Portugal.&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos @ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;</description>
      <pubDate>Tue, 12 Jan 2010 09:19:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/extracting-month-wise-data/m-p/39272#M10117</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2010-01-12T09:19:48Z</dc:date>
    </item>
  </channel>
</rss>

