<?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: How to automatically extract data from a database for the previous month in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-automatically-extract-data-from-a-database-for-the/m-p/917353#M361366</link>
    <description>&lt;P&gt;Saying that you can't get it right provides us no information that would help us solve your problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there are ERRORs in the log, show us the log. If there are no errors but the results are wrong, show us your code and the incorrect results.&lt;/P&gt;</description>
    <pubDate>Thu, 22 Feb 2024 13:35:19 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2024-02-22T13:35:19Z</dc:date>
    <item>
      <title>How to automatically extract data from a database for the previous month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automatically-extract-data-from-a-database-for-the/m-p/917135#M361268</link>
      <description>&lt;P&gt;Hi Everyone&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to automatically extract data from the database on a specific day (5th of each month) for the previous&amp;nbsp; month.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I thought of using the following macros for dates but the problem is the months days are not constant&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let Month_end_date = %sysfunc(putn(%sysfunc(intnx(day, %sysfunc(today()), -5, same)), date9.));&lt;BR /&gt;%let Month_Begin_date = %sysfunc(putn(%sysfunc(intnx(day, %sysfunc(today()), -34, same)), date9.));&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will only be applicable for the February in a leap year.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please help&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2024 11:28:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automatically-extract-data-from-a-database-for-the/m-p/917135#M361268</guid>
      <dc:creator>mmohotsi</dc:creator>
      <dc:date>2024-02-21T11:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically extract data from a database for the previous month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automatically-extract-data-from-a-database-for-the/m-p/917152#M361274</link>
      <description>&lt;P&gt;Use the INTNX function differently. SAS has done the hard work of figuring out what the starting and ending dates of each month are, leap year or not. So you don't have to figure it out somehow.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do NOT format macro variables when using them to extract data from data bases and the macro variable represent days. These values are the number of days since 01JAN1960, which is how SAS represents days and will work when you extract from the database. Using values like 01JAN2024 will not work when extracting data from a database.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let today=%sysfunc(today());
%let Month_end_date = %sysfunc(intnx(month, &amp;amp;today, -1, e));
%let Month_Begin_date = %sysfunc(intnx(month, &amp;amp;today, -1, b));

%put &amp;amp;=today;
%put &amp;amp;=month_end_date;
%put &amp;amp;=month_begin_date;&lt;/CODE&gt;&lt;/PRE&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, 21 Feb 2024 12:43:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automatically-extract-data-from-a-database-for-the/m-p/917152#M361274</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-02-21T12:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically extract data from a database for the previous month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automatically-extract-data-from-a-database-for-the/m-p/917164#M361278</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The solution worked&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just formatted the values to date by including a date9. just before the last closing parenthesis:&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;%let Month_end_date = %sysfunc(intnx(month, &amp;amp;today, -1, e));
%let Month_Begin_date = %sysfunc(intnx(month, &amp;amp;today, -1, b));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Thank you so much once again PaigeMiller&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2024 14:24:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automatically-extract-data-from-a-database-for-the/m-p/917164#M361278</guid>
      <dc:creator>mmohotsi</dc:creator>
      <dc:date>2024-02-21T14:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically extract data from a database for the previous month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automatically-extract-data-from-a-database-for-the/m-p/917165#M361279</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/77934"&gt;@mmohotsi&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are using these values to extract data from databases, formatting these macro variables is not the correct thing to do. You would use the macro variables un-formatted.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2024 14:33:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automatically-extract-data-from-a-database-for-the/m-p/917165#M361279</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-02-21T14:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically extract data from a database for the previous month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automatically-extract-data-from-a-database-for-the/m-p/917351#M361365</link>
      <description>Hi Paigemiller&lt;BR /&gt;As a SAS novice user, I am unable to maneuver on the code to get it right, hence my request to the community.&lt;BR /&gt;</description>
      <pubDate>Thu, 22 Feb 2024 13:31:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automatically-extract-data-from-a-database-for-the/m-p/917351#M361365</guid>
      <dc:creator>mmohotsi</dc:creator>
      <dc:date>2024-02-22T13:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically extract data from a database for the previous month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automatically-extract-data-from-a-database-for-the/m-p/917353#M361366</link>
      <description>&lt;P&gt;Saying that you can't get it right provides us no information that would help us solve your problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there are ERRORs in the log, show us the log. If there are no errors but the results are wrong, show us your code and the incorrect results.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 13:35:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automatically-extract-data-from-a-database-for-the/m-p/917353#M361366</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-02-22T13:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically extract data from a database for the previous month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automatically-extract-data-from-a-database-for-the/m-p/917354#M361367</link>
      <description>The code is as follows&lt;BR /&gt;filename EXECU1&lt;BR /&gt;TEMP;&lt;BR /&gt;&lt;BR /&gt;%macro Raw_Data;&lt;BR /&gt;data _null_;&lt;BR /&gt;file EXECU1;&lt;BR /&gt;  set CUSTOMER_FRAME33;&lt;BR /&gt;IF REPORT_NAME = 'ZUIKERBOSCH_DR' THEN DO;&lt;BR /&gt;&lt;BR /&gt;  put "proc sql; " / "create table " Data1 " as   " / "  select SAMPLE.SAMPLE_NUMBER, SAMPLE.PARENT_ALIQUOT, SAMPLE.SAMPLING_POINT, SAMPLE.ORIGINAL_SAMPLE,&lt;BR /&gt;                 SAMPLE.SAMPLED_DATE, RESULT.NAME, RESULT.FORMATTED_ENTRY,RESULT.UNITS,&lt;BR /&gt;                 RESULT.NUMERIC_ENTRY, RESULT.STATUS,RESULT.REPORTABLE, RESULT.RESULT_NUMBER";&lt;BR /&gt;   put " from datasource1.sample, datasource1.result" / " where sample.sample_number=result.sample_number and" / " sample.sampled_date between ";&lt;BR /&gt;   put "'"  start_date +(-1) "'d and" ;&lt;BR /&gt;   put "'"  end_date    "'d";&lt;BR /&gt;   put "and sample.sampling_point in "  SAMPLING_POINTS" and " / "  RESULT.name in "  DETERMINANDS" and " ;&lt;BR /&gt;   put "result.status = 'A' and " / " result.reportable = 'T' and " / " parent_aliquot ne 0;" ;&lt;BR /&gt;&lt;BR /&gt;;END;ELSE&lt;BR /&gt;IF REPORT_NAME = 'ZUIKERBOSCH_RD' THEN DO;&lt;BR /&gt;&lt;BR /&gt;  put "proc sql; " / "create table " Data1 " as   " / "  select SAMPLE.SAMPLE_NUMBER, SAMPLE.PARENT_ALIQUOT, SAMPLE.SAMPLING_POINT, SAMPLE.ORIGINAL_SAMPLE,&lt;BR /&gt;                 SAMPLE.SAMPLED_DATE, RESULT.NAME, RESULT.FORMATTED_ENTRY,RESULT.UNITS,&lt;BR /&gt;                 RESULT.NUMERIC_ENTRY, RESULT.STATUS,RESULT.REPORTABLE, RESULT_NUMBER";&lt;BR /&gt;   put " from datasource2.sample, datasource2.result" / " where sample.sample_number=result.sample_number and" / " sample.sampled_date between ";&lt;BR /&gt;   put "'"  start_date +(-1) "'d and" ;&lt;BR /&gt;   put "'"  end_date    "'d";&lt;BR /&gt;   put "and sample.sampling_point in "  SAMPLING_POINTS" and " / "  RESULT.name in "  DETERMINANDS" and " ;&lt;BR /&gt;   put "result.status = 'A' and " / " result.reportable = 'T' and " / " parent_aliquot ne 0;" ;&lt;BR /&gt;&lt;BR /&gt;;END;&lt;BR /&gt;&lt;BR /&gt;%include EXECU1;&lt;BR /&gt;%mend Raw_Data;&lt;BR /&gt;%Raw_Data;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The log is as follows:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;1          ;*';*";*/;quit;run;&lt;BR /&gt;2          OPTIONS PAGENO=MIN;&lt;BR /&gt;3          %LET _CLIENTTASKLABEL='Program';&lt;BR /&gt;4          %LET _CLIENTPROCESSFLOWNAME='POC';&lt;BR /&gt;5          %LET _CLIENTPROJECTPATH='C:\Users\imstats\Documents\Disater_Implememtation\SAS_Programmes\POC\ZB_POC\ZB_POC_PROJECT.egp';&lt;BR /&gt;6          %LET _CLIENTPROJECTPATHHOST='IMSAS-C7704';&lt;BR /&gt;7          %LET _CLIENTPROJECTNAME='ZB_POC_PROJECT.egp';&lt;BR /&gt;8          %LET _SASPROGRAMFILE='';&lt;BR /&gt;9          %LET _SASPROGRAMFILEHOST='';&lt;BR /&gt;10&lt;BR /&gt;11         ODS _ALL_ CLOSE;&lt;BR /&gt;12         OPTIONS DEV=SVG;&lt;BR /&gt;13         GOPTIONS XPIXELS=0 YPIXELS=0;&lt;BR /&gt;14         %macro HTML5AccessibleGraphSupported;&lt;BR /&gt;15             %if %_SAS_VERCOMP_FV(9,4,4, 0,0,0) &amp;gt;= 0 %then ACCESSIBLE_GRAPH;&lt;BR /&gt;16         %mend;&lt;BR /&gt;17         ODS LISTING GPATH=&amp;amp;sasworklocation;&lt;BR /&gt;18         FILENAME EGHTML TEMP;&lt;BR /&gt;19         ODS HTML5(ID=EGHTML) FILE=EGHTML&lt;BR /&gt;20             OPTIONS(BITMAP_MODE='INLINE')&lt;BR /&gt;21             %HTML5AccessibleGraphSupported&lt;BR /&gt;22             ENCODING='utf-8'&lt;BR /&gt;23             STYLE=HTMLBlue&lt;BR /&gt;24             NOGTITLE&lt;BR /&gt;25             NOGFOOTNOTE&lt;BR /&gt;26             GPATH=&amp;amp;sasworklocation&lt;BR /&gt;27         ;&lt;BR /&gt;NOTE: Writing HTML5(EGHTML) Body file: EGHTML&lt;BR /&gt;28         FILENAME EGPDF TEMP;&lt;BR /&gt;29         ODS PDF(ID=EGPDF) FILE=EGPDF STYLE=Pearl;&lt;BR /&gt;NOTE: Writing ODS PDF(EGPDF) output to DISK destination "EGPDF", printer "PDF".&lt;BR /&gt;30         FILENAME EGSR TEMP;&lt;BR /&gt;31         ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR&lt;BR /&gt;32             STYLE=HTMLBlue&lt;BR /&gt;33             NOGTITLE&lt;BR /&gt;34             NOGFOOTNOTE&lt;BR /&gt;35             GPATH=&amp;amp;sasworklocation&lt;BR /&gt;36             ENCODING=UTF8&lt;BR /&gt;37             options(rolap="on")&lt;BR /&gt;38         ;&lt;BR /&gt;NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR&lt;BR /&gt;39         FILENAME EGXLSSX TEMP;&lt;BR /&gt;40         ODS EXCEL(ID=EGXLSSX) FILE=EGXLSSX STYLE=Excel&lt;BR /&gt;41         OPTIONS (&lt;BR /&gt;42          EMBEDDED_TITLES="yes" EMBEDDED_FOOTNOTES="yes"&lt;BR /&gt;43         );&lt;BR /&gt;WARNING: Unsupported device 'SVG' for EXCEL(EGXLSSX) destination. Using default device 'PNG'.&lt;BR /&gt;44&lt;BR /&gt;45         filename EXECU1&lt;BR /&gt;46         TEMP;&lt;BR /&gt;47&lt;BR /&gt;48         %macro Raw_Data;&lt;BR /&gt;49         data _null_;&lt;BR /&gt;50          file EXECU1;&lt;BR /&gt;51           set CUSTOMER_FRAME33;&lt;BR /&gt;52         IF REPORT_NAME = 'ZUIKERBOSCH_DR' THEN DO;&lt;BR /&gt;53&lt;BR /&gt;54           put "proc sql; " / "create table " Data1 " as   " / "  select SAMPLE.SAMPLE_NUMBER, SAMPLE.PARENT_ALIQUOT, SAMPLE.SAMPLING_POINT, SAMPLE.ORIGINAL_SAMPLE,&lt;BR /&gt;55                          SAMPLE.SAMPLED_DATE, RESULT.NAME, RESULT.FORMATTED_ENTRY,RESULT.UNITS,&lt;BR /&gt;56                          RESULT.NUMERIC_ENTRY, RESULT.STATUS,RESULT.REPORTABLE, RESULT.RESULT_NUMBER";&lt;BR /&gt;57            put " from datasource1.sample, datasource1.result" / " where sample.sample_number=result.sample_number and" / " sample.sampled_date between ";&lt;BR /&gt;58            put "'"  start_date +(-1) "'d and" ;&lt;BR /&gt;59            put "'"  end_date    "'d";&lt;BR /&gt;60            put "and sample.sampling_point in "  SAMPLING_POINTS" and " / "  RESULT.name in "  DETERMINANDS" and " ;&lt;BR /&gt;61            put "result.status = 'A' and " / " result.reportable = 'T' and " / " parent_aliquot ne 0;" ;&lt;BR /&gt;62&lt;BR /&gt;63         ;END;ELSE&lt;BR /&gt;64         IF REPORT_NAME = 'ZUIKERBOSCH_RD' THEN DO;&lt;BR /&gt;65&lt;BR /&gt;66           put "proc sql; " / "create table " Data1 " as   " / "  select SAMPLE.SAMPLE_NUMBER, SAMPLE.PARENT_ALIQUOT, SAMPLE.SAMPLING_POINT, SAMPLE.ORIGINAL_SAMPLE,&lt;BR /&gt;67                          SAMPLE.SAMPLED_DATE, RESULT.NAME, RESULT.FORMATTED_ENTRY,RESULT.UNITS,&lt;BR /&gt;68                          RESULT.NUMERIC_ENTRY, RESULT.STATUS,RESULT.REPORTABLE, RESULT_NUMBER";&lt;BR /&gt;69            put " from datasource2.sample, datasource2.result" / " where sample.sample_number=result.sample_number and" / " sample.sampled_date between ";&lt;BR /&gt;70            put "'"  start_date +(-1) "'d and" ;&lt;BR /&gt;71            put "'"  end_date    "'d";&lt;BR /&gt;72            put "and sample.sampling_point in "  SAMPLING_POINTS" and " / "  RESULT.name in "  DETERMINANDS" and " ;&lt;BR /&gt;73            put "result.status = 'A' and " / " result.reportable = 'T' and " / " parent_aliquot ne 0;" ;&lt;BR /&gt;74&lt;BR /&gt;75         ;END;&lt;BR /&gt;76&lt;BR /&gt;77         %include EXECU1;&lt;BR /&gt;78         %mend Raw_Data;&lt;BR /&gt;79         %Raw_Data;&lt;BR /&gt;WARNING: Physical file does not exist, C:\Users\imstats\AppData\Roaming\SAS\EnterpriseGuide\EGTEMP\SEG-3604-fd8ff039\contents\SAS Temporary Files\_TD16136_IMSAS-C7704_\#LN03879.&lt;BR /&gt;ERROR: Cannot open %INCLUDE file EXECU1.&lt;BR /&gt;80&lt;BR /&gt;81         %LET _CLIENTTASKLABEL=;&lt;BR /&gt;82         %LET _CLIENTPROCESSFLOWNAME=;&lt;BR /&gt;83         %LET _CLIENTPROJECTPATH=;&lt;BR /&gt;84         %LET _CLIENTPROJECTPATHHOST=;&lt;BR /&gt;85         %LET _CLIENTPROJECTNAME=;&lt;BR /&gt;86         %LET _SASPROGRAMFILE=;&lt;BR /&gt;87         %LET _SASPROGRAMFILEHOST=;&lt;BR /&gt;88&lt;BR /&gt;89         ;*';*";*/;quit;run;&lt;BR /&gt;                     ____&lt;BR /&gt;                     180&lt;BR /&gt;&lt;BR /&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;BR /&gt;&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;      real time           0.00 seconds&lt;BR /&gt;      cpu time            0.00 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;90         ODS _ALL_ CLOSE;&lt;BR /&gt;NOTE: ODS PDF(EGPDF) printed no output.&lt;BR /&gt;      (This sometimes results from failing to place a RUN statement before the ODS PDF(EGPDF) CLOSE statement.)&lt;BR /&gt;NOTE: Writing EXCEL(EGXLSSX) file: C:\Users\imstats\AppData\Roaming\SAS\EnterpriseGuide\EGTEMP\SEG-3604-fd8ff039\contents\SAS Temporary Files\_TD16136_IMSAS-C7704_\#LN03856&lt;BR /&gt;91&lt;BR /&gt;92&lt;BR /&gt;93         QUIT; RUN;&lt;BR /&gt;94&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;MMohotsi&lt;BR /&gt;</description>
      <pubDate>Thu, 22 Feb 2024 13:43:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automatically-extract-data-from-a-database-for-the/m-p/917354#M361367</guid>
      <dc:creator>mmohotsi</dc:creator>
      <dc:date>2024-02-22T13:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically extract data from a database for the previous month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automatically-extract-data-from-a-database-for-the/m-p/917358#M361370</link>
      <description>&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ERROR: Cannot open %INCLUDE file EXECU1.&lt;/PRE&gt;
&lt;P&gt;This has nothing to do with your macro variables. You are trying to use a file that has not been properly identified. &lt;CODE class=" language-sas"&gt;
&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS does not know what EXECU1 is. You need a RUN; to close the DATA step, and then the file is created properly and will then SAS will be able to %include it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you create macro variables to contain dates, you still have to use proper SAS code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;put "'" start_date +(-1) "'d and" ;
put "'" end_date "'d";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Start_date and end_date are not variables, they are macro variables. So you want to include an ampersand before the variable name. In addition, if the macro variables are unformatted as I suggested, then you want&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;put "&amp;amp;start_date and &amp;amp;end_date";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How simple is that? I am not sure why you are adding -1 in your code, but if you think that's still needed, modify the code above to subtract 1.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Question: why is this a macro anyway? Why not just have DATA _NULL_ followed by %include outside of a macro?&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, 22 Feb 2024 13:59:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automatically-extract-data-from-a-database-for-the/m-p/917358#M361370</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-02-22T13:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically extract data from a database for the previous month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automatically-extract-data-from-a-database-for-the/m-p/917362#M361373</link>
      <description>Hi PaigeMiller&lt;BR /&gt;The variables  start_date , end_date, Determinands, and Sampling_points  are from the staging table&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;MMohotsi&lt;BR /&gt;</description>
      <pubDate>Thu, 22 Feb 2024 14:00:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automatically-extract-data-from-a-database-for-the/m-p/917362#M361373</guid>
      <dc:creator>mmohotsi</dc:creator>
      <dc:date>2024-02-22T14:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically extract data from a database for the previous month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automatically-extract-data-from-a-database-for-the/m-p/917363#M361374</link>
      <description>&lt;P&gt;So where are the macro variables used?&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;What is a typical value of start_date and end_date? Is it numeric or character according to PROC CONTENTS? How is it formatted according to PROC CONTENTS?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 14:03:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automatically-extract-data-from-a-database-for-the/m-p/917363#M361374</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-02-22T14:03:09Z</dc:date>
    </item>
  </channel>
</rss>

