<?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: Creating a macro for the first time in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/468408#M30388</link>
    <description>&lt;P&gt;Thanks Art297 !!&lt;/P&gt;&lt;P&gt;I was wondering if that would pull unnecessary data but it didn't&lt;/P&gt;&lt;P&gt;Thank you again!!&lt;/P&gt;</description>
    <pubDate>Thu, 07 Jun 2018 15:20:11 GMT</pubDate>
    <dc:creator>new_sas_user_4</dc:creator>
    <dc:date>2018-06-07T15:20:11Z</dc:date>
    <item>
      <title>Creating a macro for the first time</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/467838#M30342</link>
      <description>&lt;P&gt;hi everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to the SAS forum and also to the world of SAS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have recently started using SAS as part of my daily job!! looking for some guidance and help here !!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am&amp;nbsp;trying to pull data for :&lt;/P&gt;&lt;P&gt;current month till today&amp;nbsp;&lt;/P&gt;&lt;P&gt;full prior month (everyday) because its dynamic&lt;/P&gt;&lt;P&gt;prior year MTD(month to date)&amp;nbsp;&lt;/P&gt;&lt;P&gt;Prior month&amp;nbsp;&lt;SPAN&gt;MTD(month to date)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I want to create a macro which indicates&amp;nbsp;the date/ date range so I&amp;nbsp;dont have to do multiple pulls, instead pull all of the above data in one program..&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I hope what I am asking makes sense..&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Please help!!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Also, if there is any reference material for SAS macros/automations(getting a report in SAS and then publishing it via SAS) or a good book, please advise..&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2018 20:13:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/467838#M30342</guid>
      <dc:creator>new_sas_user_4</dc:creator>
      <dc:date>2018-06-05T20:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a macro for the first time</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/467848#M30344</link>
      <description>&lt;P&gt;You don't need a macro. You can create all four files, dynamically, with a single data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The first two desired files seem simple enough, but you'll have to explain what you mean by your definition of the third and fourth files.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will need to use the today() and intnx functions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are all kinds of free and for pay information about SAS and about SAS macros.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, first learn SAS before you try to take on the SAS macro language.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2018 20:31:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/467848#M30344</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-06-05T20:31:12Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a macro for the first time</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/467850#M30345</link>
      <description>&lt;P&gt;I don't know if this is good news or bad news, but macros are not needed here.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Come back with a working program (with hard-coded dates), and it will be relatively easy to show you how to make it dynamic depending on the date the program is run.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2018 20:34:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/467850#M30345</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-06-05T20:34:03Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a macro for the first time</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/467854#M30346</link>
      <description>&lt;P&gt;This is a good beginner reference.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stats.idre.ucla.edu/sas/seminars/sas-macros-introduction/" target="_blank"&gt;https://stats.idre.ucla.edu/sas/seminars/sas-macros-introduction/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2018 20:45:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/467854#M30346</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-05T20:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a macro for the first time</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/467862#M30347</link>
      <description>&lt;P&gt;Welcome to SAS! I hope you don't find it too traumatic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You've posted this in the Enterprise Guide forum, but you're asking about a programming construct.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you okay writing SAS code, or are you looking to only use the Enterprise Guide "point and click" facilities?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2018 21:31:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/467862#M30347</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2018-06-05T21:31:41Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a macro for the first time</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/467900#M30348</link>
      <description>&lt;P&gt;Thank you everyone &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new here so I am not sure if I have posted my question at the right place. I write proc sql codes for my data pulls.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I want:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data for:&lt;/P&gt;&lt;P&gt;1st june, 2018&amp;nbsp; till today(5th June 2018)&lt;/P&gt;&lt;P&gt;prior month - 1st may to 31st may 2018&lt;/P&gt;&lt;P&gt;prior month to date - 1st may to 5th may 2018&lt;/P&gt;&lt;P&gt;prior year - 1st June to 5th June 2017&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These dates will keep changing as this report is required to be run daily:&lt;/P&gt;&lt;P&gt;So on 6th June 2018, I need to see:&lt;/P&gt;&lt;P&gt;1st june, 2018&amp;nbsp; till&amp;nbsp;6th June&lt;/P&gt;&lt;P&gt;prior month - 1st may to 31st may 2018(to be pulled again as my data is dynamic)&lt;/P&gt;&lt;P&gt;prior month to date - 1st may to 6th may 2018&lt;/P&gt;&lt;P&gt;prior year - 1st June to 6th June 2017&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and so on...I hope my question is clearer now...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so I can start as:&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table X as select a,b,c from table_name&lt;/P&gt;&lt;P&gt;where date between &lt;EM&gt;start of month(from intnx function like art297 mentioned)&amp;nbsp; &lt;/EM&gt;and today(),&lt;/P&gt;&lt;P&gt;............&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>Tue, 05 Jun 2018 23:43:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/467900#M30348</guid>
      <dc:creator>new_sas_user_4</dc:creator>
      <dc:date>2018-06-05T23:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a macro for the first time</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/467928#M30349</link>
      <description>&lt;P&gt;Sounds like you want something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table current_month as
    select date,a,b,c
      from have
        where date between intnx('month',today(),0,'b') and today()
  ;
  create table prior_month as
    select date,a,b,c
      from have
        where date between intnx('month',today(),-1,'b') and intnx('month',today(),-1,'e')
  ;
  create table prior_month_to_date as
    select date,a,b,c
      from have
        where date between intnx('month',today(),-1,'b') and intnx('month',today(),-1,'s')
  ;
  create table prior_year as
    select date,a,b,c
      from have
        where date between intnx('month',today(),-12,'b') and intnx('month',today(),-1,'s')
  ;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Of course, can't test it without data, but I'd think that you could take it from here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 01:24:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/467928#M30349</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-06-06T01:24:48Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a macro for the first time</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/467931#M30350</link>
      <description>&lt;P&gt;Thank you soooooooo much Art297 &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 01:54:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/467931#M30350</guid>
      <dc:creator>new_sas_user_4</dc:creator>
      <dc:date>2018-06-06T01:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a macro for the first time</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/467932#M30351</link>
      <description>&lt;P&gt;- For future reference, could you please suggest where should I post questions related for querying data(like this one) or is this the right place?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Also,&amp;nbsp;I have&amp;nbsp;to create the above query for multiple groups of data which should be automated in SAS such that it can be sent out as a pdf in a mail (from SAS directly at say 7am everyday)....could you direct me to any reference material for this...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 01:59:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/467932#M30351</guid>
      <dc:creator>new_sas_user_4</dc:creator>
      <dc:date>2018-06-06T01:59:53Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a macro for the first time</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/467939#M30352</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/213838"&gt;@new_sas_user_4&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;- For future reference, could you please suggest where should I post questions related for querying data(like this one) or is this the right place?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Post it here, under&amp;nbsp;&lt;A href="https://communities.sas.com/t5/Base-SAS-Programming/bd-p/programming" target="_blank"&gt;Base SAS Programming&lt;/A&gt;&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/213838"&gt;@new_sas_user_4&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;- Also,&amp;nbsp;I have&amp;nbsp;to create the above query for multiple groups of data which should be automated in SAS such that it can be sent out as a pdf in a mail (from SAS directly at say 7am everyday)....could you direct me to any reference material for this...&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Before you build a macro and a big process get it working without macro code for one iteration/situation and then generalize it. I guarantee this is faster than if you go straight into macro code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is a bit of a bigger task, that should be broken into steps and you can ask questions for each step.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The PDF part is easy, just change the result type to generate a PDF report as well. Anything directed to results would be in the PDF instead. If you want a programming approach, it depends on how complex your reports get, it could be as simple as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods pdf file='/folders/myfolders/demo.pdf' style=meadow;

proc print data=sashelp.class;
run;


ods pdf close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And as complex as this:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings15/SAS1836-2015.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings15/SAS1836-2015.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the email portion:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/resources/papers/proceedings17/1060-2017.pdf" target="_blank"&gt;http://support.sas.com/resources/papers/proceedings17/1060-2017.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 03:05:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/467939#M30352</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-06T03:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a macro for the first time</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/467943#M30353</link>
      <description>&lt;P&gt;Like&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;said, Base SAS Programming would have been a good choice for your original question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, what she didn't mention is that subsequent questions should be posted, wherever they best fit, but as a new thread. In the present case, since you're using EG and are asking about scheduling jobs, I'd post it there (i.e., right where you posted this current thread).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 03:13:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/467943#M30353</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-06-06T03:13:34Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a macro for the first time</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/468163#M30377</link>
      <description>&lt;P&gt;Thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 18:30:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/468163#M30377</guid>
      <dc:creator>new_sas_user_4</dc:creator>
      <dc:date>2018-06-06T18:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a macro for the first time</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/468374#M30384</link>
      <description>&lt;P&gt;Also a quick question related to the above query:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Will it be possible to get the data for ALL dates using one query ?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table X as select a, b,c&amp;nbsp;&lt;/P&gt;&lt;P&gt;from table_name&lt;/P&gt;&lt;P&gt;where date ..............&lt;BR /&gt;intnx('month',today(),0,'b') and (today()), /*CM MTD*/&lt;BR /&gt;intnx('month',today(),-12,'b') and intnx('month',today(),-12,'s'), /*PY MTD*/&lt;BR /&gt;intnx('month',today(),-1,'b') and intnx('month',today(),-1,'s'), /*PM MTD*/&lt;BR /&gt;intnx('month',today()-,-1,'b') and intnx('month',today(),-1,'e') /*PM start to end*/&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or I should pull all dates separately as directed by art297 and then join all of them?&lt;/P&gt;&lt;P&gt;Data all_data;&lt;/P&gt;&lt;P&gt;set table1 table2 table3; /*table1 table2 table3 would have the respective pulls for different time periods*/&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 14:18:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/468374#M30384</guid>
      <dc:creator>new_sas_user_4</dc:creator>
      <dc:date>2018-06-07T14:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a macro for the first time</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/468381#M30385</link>
      <description>&lt;P&gt;Do you want just one table and, if so, do you want to create a variable that shows the type (and, if so, using what values to represent the four types)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, would you want that file to include the records that don't match the four types?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 14:30:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/468381#M30385</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-06-07T14:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a macro for the first time</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/468389#M30386</link>
      <description>&lt;P&gt;I want one table which shows:&lt;/P&gt;&lt;P&gt;all the Dates , week, corresponding A, B, C (a,b,c being the columns which have data for sales, revenue etc)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I &lt;U&gt;don't&lt;/U&gt; want the date to be distinguished as in this is CM Data , this is PM data etc&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this what you are asking by&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;"create a variable that shows the type"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I do want a column after Date which would show the week , which I think should be easy to extract just by using the week function..&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 14:37:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/468389#M30386</guid>
      <dc:creator>new_sas_user_4</dc:creator>
      <dc:date>2018-06-07T14:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a macro for the first time</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/468402#M30387</link>
      <description>&lt;P&gt;Then why not just use one sql call OR'ing the four conditions? If the week function provides what you want, you can easily add that to your select clause.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 14:58:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/468402#M30387</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-06-07T14:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a macro for the first time</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/468408#M30388</link>
      <description>&lt;P&gt;Thanks Art297 !!&lt;/P&gt;&lt;P&gt;I was wondering if that would pull unnecessary data but it didn't&lt;/P&gt;&lt;P&gt;Thank you again!!&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 15:20:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/468408#M30388</guid>
      <dc:creator>new_sas_user_4</dc:creator>
      <dc:date>2018-06-07T15:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a macro for the first time</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/468814#M30408</link>
      <description>&lt;P&gt;Hello everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am a bit stuck on a query. Below are the codes and the results are attached :&lt;/P&gt;&lt;P&gt;Please help!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table X as select distinct DT,CYCLE_MTH&lt;BR /&gt;from&amp;nbsp;table_name where&lt;BR /&gt;DT between intnx('month',today()-4,0,'b') and (today()-4)&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;or DT between intnx('month',today()-4,-12,'b') and intnx('month',today()-4,-12,'s') /*PY MTD*/&lt;BR /&gt;and month(CYCLE_MTH)= month(today()-4)+1;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table X1 as select distinct DT,CYCLE_MTH&lt;BR /&gt;from&amp;nbsp;table_name&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;where&lt;BR /&gt;DT between intnx('month',today()-4,0,'b') and (today()-4)&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;and month(CYCLE_MTH)= month(today()-4)+1;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table X2 as select distinct DT,CYCLE_MTH&lt;BR /&gt;from table_name where&lt;BR /&gt;DT between intnx('month',today()-4,-12,'b') and intnx('month',today()-4,-12,'s') /*PY MTD*/&lt;BR /&gt;and month(CYCLE_MTH)= month(today()-4)+1;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attached the results from the 3 pulls below.&lt;/P&gt;&lt;P&gt;My concern is : If I am pulling data separately as in X1 and X2 , the results are as I expect them to be!&lt;/P&gt;&lt;P&gt;but in extract&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;X,&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;I get values such as DT = 01JUN2018 and CYCLE_MTH = 01JUN2018 which isn't expected.&lt;/P&gt;&lt;P&gt;My desired result is X1 and X2 as one single table (CYCLE_MTH 01JUN2018 should not come up.)&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;OR&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;X but without CYCLE_MTH 01JUN2018&amp;nbsp;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could this be because I am using AND and OR conditions together? or could this be a database error?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!!!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jun 2018 17:43:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/468814#M30408</guid>
      <dc:creator>new_sas_user_4</dc:creator>
      <dc:date>2018-06-08T17:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a macro for the first time</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/468839#M30413</link>
      <description>&lt;P&gt;Always use parentheses to specify a complex where statement. Otherwise you risk getting what you asked for, rather than what you thought you asked for:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table X as select distinct DT,CYCLE_MTH
    from table_name
      where (DT between intnx('month',today()-4,0,'b') and (today()-4) 
        or DT between intnx('month',today()-4,-12,'b') and intnx('month',today()-4,-12,'s')) /*PY MTD*/
      and month(CYCLE_MTH)= month(today()-4)+1
  ;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jun 2018 19:17:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/468839#M30413</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-06-08T19:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a macro for the first time</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/469214#M30428</link>
      <description>&lt;P&gt;Thank you Art297 &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 13:07:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-for-the-first-time/m-p/469214#M30428</guid>
      <dc:creator>new_sas_user_4</dc:creator>
      <dc:date>2018-06-11T13:07:08Z</dc:date>
    </item>
  </channel>
</rss>

