<?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: automation of calling a macro having year and quarter as parameter in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/automation-of-calling-a-macro-having-year-and-quarter-as/m-p/387755#M92985</link>
    <description>&lt;P&gt;Ue the power of Base SAS to do data processing:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  do yr=2017 to 2017;
    do qtr=1 to 4;
      call execute('%mobileq8 (year='||put(year,4.)||'Q'||put(qtr,1.)||',qtr='||put(year,4.)||'Q'||put(qtr,1.)||');');
    end;
  end;
run;&lt;/PRE&gt;
&lt;P&gt;Although why you are doing it this way in the first place is beyond me. &amp;nbsp;Put Year and QTR in your data as data items - whch they are - then use By Group Processing - a fundamental skill of SAS programming - which will make your code infinitely simpler, faster, and easier to maintain.&lt;/P&gt;</description>
    <pubDate>Mon, 14 Aug 2017 12:57:32 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-08-14T12:57:32Z</dc:date>
    <item>
      <title>automation of calling a macro having year and quarter as parameter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/automation-of-calling-a-macro-having-year-and-quarter-as/m-p/387740#M92978</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;EM&gt;I want to automate this code given below , I dont want write Year = 2014Q1 or QTR=14Q1.....&lt;BR /&gt;so once i enter to year 2018 , it should automatically create a call to year = 2018Q1 and QTR=18Q1&lt;BR /&gt;&lt;/EM&gt;&lt;BR /&gt;%MACRO MOBILEQ8 (YEAR, QTR);

%MEND

%MOBILEQ8 (YEAR = '2014Q1', QTR=14Q1);
%MOBILEQ8 (YEAR = '2014Q2', QTR=14Q2);
%MOBILEQ8 (YEAR = '2014Q3', QTR=14Q3);
%MOBILEQ8 (YEAR = '2014Q4', QTR=14Q4);
%MOBILEQ8 (YEAR = '2015Q1', QTR=15Q1);
%MOBILEQ8 (YEAR = '2015Q2', QTR=15Q2);
%MOBILEQ8 (YEAR = '2015Q3', QTR=15Q3);
%MOBILEQ8 (YEAR = '2015Q4', QTR=15Q4);
%MOBILEQ8 (YEAR = '2016Q1', QTR=16Q1);
%MOBILEQ8 (YEAR = '2016Q2', QTR=16Q2);
%MOBILEQ8 (YEAR = '2016Q3', QTR=16Q3);
%MOBILEQ8 (YEAR = '2016Q4', QTR=16Q4);
%MOBILEQ8 (YEAR = '2017Q1', QTR=17Q1);
%MOBILEQ8 (YEAR = '2017Q2', QTR=17Q2);
%MOBILEQ8 (YEAR = '2017Q3', QTR=17Q3);
%MOBILEQ8 (YEAR = '2017Q4', QTR=17Q4);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Aug 2017 12:20:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/automation-of-calling-a-macro-having-year-and-quarter-as/m-p/387740#M92978</guid>
      <dc:creator>subrat1</dc:creator>
      <dc:date>2017-08-14T12:20:53Z</dc:date>
    </item>
    <item>
      <title>Re: automation of calling a macro having year and quarter as parameter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/automation-of-calling-a-macro-having-year-and-quarter-as/m-p/387755#M92985</link>
      <description>&lt;P&gt;Ue the power of Base SAS to do data processing:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  do yr=2017 to 2017;
    do qtr=1 to 4;
      call execute('%mobileq8 (year='||put(year,4.)||'Q'||put(qtr,1.)||',qtr='||put(year,4.)||'Q'||put(qtr,1.)||');');
    end;
  end;
run;&lt;/PRE&gt;
&lt;P&gt;Although why you are doing it this way in the first place is beyond me. &amp;nbsp;Put Year and QTR in your data as data items - whch they are - then use By Group Processing - a fundamental skill of SAS programming - which will make your code infinitely simpler, faster, and easier to maintain.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 12:57:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/automation-of-calling-a-macro-having-year-and-quarter-as/m-p/387755#M92985</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-08-14T12:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: automation of calling a macro having year and quarter as parameter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/automation-of-calling-a-macro-having-year-and-quarter-as/m-p/387758#M92987</link>
      <description>&lt;P&gt;Writing a new macro would loop through all the values.&amp;nbsp; It's somewhat easier if you can use double quotes instead of single quotes around the &amp;amp;YEAR values:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro loop;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; %local year quarter;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; %do year = 14 %to 17;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %do quarter = 1 %to 4;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %MOBILEQ8 (YEAR = "20&amp;amp;year.Q&amp;amp;quarter.", QTR = &amp;amp;year.Q&amp;amp;quarter)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; %end;&lt;/P&gt;
&lt;P&gt;%mend loop;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%loop&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you must have single quotes, the value for YEAR= becomes more complex:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;YEAR = %unquote(%str(%'20&amp;amp;year.Q&amp;amp;quarter.%'))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The complication is due to the fact that single quotes suppress macro language activity (including resolution of macro variable references).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are ways to make this more flexible (which years to process, which quarters to process), but this is a good starting point in any case.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 13:00:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/automation-of-calling-a-macro-having-year-and-quarter-as/m-p/387758#M92987</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-08-14T13:00:25Z</dc:date>
    </item>
    <item>
      <title>Re: automation of calling a macro having year and quarter as parameter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/automation-of-calling-a-macro-having-year-and-quarter-as/m-p/387805#M92996</link>
      <description>&lt;P&gt;Style note:&lt;/P&gt;
&lt;P&gt;Anyone giving me a YEAR variable that contains quarter information should expect a barrage of questions about the variable name and content. Similar for a quarter that contains year information.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And why is Year in quotes and quarter not? I find dealing with quotes as part of a variable generally a tad awkward to work with.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 15:02:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/automation-of-calling-a-macro-having-year-and-quarter-as/m-p/387805#M92996</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-08-14T15:02:40Z</dc:date>
    </item>
  </channel>
</rss>

