<?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: Macro help please in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182828#M14031</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;12 year old unsupported software isn't a great idea in general.&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-style: inherit;"&gt;data test ;&lt;/P&gt;&lt;P style="font-style: inherit;"&gt;&amp;nbsp; length indsname dsname $256 ;&lt;/P&gt;&lt;P style="font-style: inherit;"&gt;&amp;nbsp; set&lt;/P&gt;&lt;P style="font-style: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rep1.&lt;SPAN style="font-style: inherit;"&gt;test_check (in=a)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-style: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rep2.test_check (in=b)&lt;/P&gt;&lt;P style="font-style: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rep3.test_check (in=c)&lt;/P&gt;&lt;P style="font-style: inherit;"&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P style="font-style: inherit;"&gt;&amp;nbsp; where date ne today()-2 ;&lt;/P&gt;&lt;P style="font-style: inherit;"&gt;dsname=a*1+b*2+c*3 ; /*1=rep1, 2=rep2, 3=rep3*/&lt;/P&gt;&lt;P style="font-style: inherit;"&gt;run;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A _jive_internal="true" href="https://communities.sas.com/message-abuse!input.jspa?objectID=259375&amp;amp;objectType=2" style="font-style: inherit; font-family: inherit; color: #0e66ba;"&gt;&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Mar 2015 20:24:04 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2015-03-02T20:24:04Z</dc:date>
    <item>
      <title>Macro help please</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182793#M13996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am running below code and getting error -&lt;/P&gt;&lt;P&gt;date value for "test_check" dataset is Mon, Feb 23, 2015.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;output - would be - number of datasets (ana&amp;amp;i.) where date value is not today()-2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;options symbolgen merror serror spool;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;%macro test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;%do i=1 %to 10;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;&amp;nbsp;&amp;nbsp; libname rep&amp;amp;i. "f:\woo\dir&amp;amp;i.\test_datasets";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;data ana&amp;amp;i.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;set rep&amp;amp;i..test_check;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;%if "date"d ne %sysfunc(today()worddate.)-2 %then %do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;&amp;nbsp;&amp;nbsp; output ana&amp;amp;i.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;&amp;nbsp;&amp;nbsp; %end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;%end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;%mend;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;%test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR: Expected close parenthesis after macro function invocation not found.&lt;/P&gt;&lt;P&gt;ERROR: Required operator not found in expression: "date"d ne&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %sysfunc(today()worddate.)-2&lt;/P&gt;&lt;P&gt;ERROR: The macro CHECK will stop executing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Feb 2015 19:59:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182793#M13996</guid>
      <dc:creator>woo</dc:creator>
      <dc:date>2015-02-25T19:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help please</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182794#M13997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are lots of problems here.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;What is the format of "date" ? Is it a true SAS date value or a character string or something else?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is %check ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You don't need %sysfunc anyway, you could just use today() without any macro functions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Feb 2015 20:09:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182794#M13997</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2015-02-25T20:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help please</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182795#M13998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;What is the format of "date" ? Is it a true &lt;STRONG&gt;SAS date&lt;/STRONG&gt; value or a character string or something else? &lt;STRONG&gt;date=Mon, Feb 23, 2015&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;What is %check ? - by mistake matched with another macro - &lt;STRONG&gt;deleted &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;You don't need %sysfunc anyway, you could just use today() without any macro functions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Feb 2015 20:44:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182795#M13998</guid>
      <dc:creator>woo</dc:creator>
      <dc:date>2015-02-25T20:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help please</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182796#M13999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So Date is a character string, is that what you are saying?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And it uses month abreviations (Feb instead of February)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And it uses day abbreviations (Mon instead of Monday) followed by a comma and a space?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; (Or is date a SAS data value formatted as a character string?)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Feb 2015 20:52:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182796#M13999</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2015-02-25T20:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help please</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182797#M14000</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;So Date is a character string, is that what you are saying? - date variable is "date type data of-course&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;And it uses month abreviations (Feb instead of February)? date value is = &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;Mon, Feb 23, 2015 (i think we can use weekdate17.)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;And it uses day abbreviations (Mon instead of Monday) followed by a comma and a space?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;(Or is date a SAS data value formatted as a character string?)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Feb 2015 21:04:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182797#M14000</guid>
      <dc:creator>woo</dc:creator>
      <dc:date>2015-02-25T21:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help please</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182798#M14001</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Okay, you use weekdate17.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then your original problem is solved like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333;"&gt;%macro test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333;"&gt;%do i=1 %to 10;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333;"&gt;&amp;nbsp;&amp;nbsp; libname rep&amp;amp;i. "f:\woo\dir&amp;amp;i.\test_datasets";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333;"&gt;data ana&amp;amp;i.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333;"&gt;set rep&amp;amp;i..test_check;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333;"&gt;if date ne (today()-2) then output;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333;"&gt;%end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333;"&gt;%mend;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333;"&gt;%test&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Feb 2015 21:10:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182798#M14001</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2015-02-25T21:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help please</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182799#M14002</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i tried this but i am getting all 10 sas datasets (ana1 to ana10) where some datasets doens't has any value for variable "date" and some datasets (2 actually) where has value for "date" variable which is satisfying "IF" condition. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Isn't it we supposed to get only those 2 datasets where date value is not matching.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3366ff; background-color: #ffffff;"&gt;if date ne (today()-2) then &lt;/SPAN&gt;&lt;SPAN style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3366ff; background-color: #ffffff;"&gt;output ana&amp;amp;i.;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Feb 2015 21:19:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182799#M14002</guid>
      <dc:creator>woo</dc:creator>
      <dc:date>2015-02-25T21:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help please</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182800#M14003</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your macro checks against the variable values "DATE"&amp;nbsp; in a dataset. If no values are present the dataset is created, but is empty.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You need to add a step to not create the data step or delete it if the number of observations are 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This would go something like (pseudo code):&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Check for values of date in dataset using proc sql&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="line-height: 1.5em; font-size: 10pt;"&gt;if count of obs&amp;gt;0 then proceed with data step as &lt;/SPAN&gt;above&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="line-height: 1.5em;"&gt; code. (macro logic, &lt;/SPAN&gt;&lt;SPAN style="line-height: 19.5px;"&gt;i.e.&lt;/SPAN&gt;&lt;SPAN style="line-height: 1.5em;"&gt; %if)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="line-height: 1.5em; font-size: 10pt;"&gt;no else required&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="line-height: 1.5em; font-size: 10pt;"&gt;end loop &lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Feb 2015 21:58:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182800#M14003</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-02-25T21:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help please</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182801#M14004</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i tried with this code but it is giving syntax error////&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #333333;"&gt;%macro test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #333333;"&gt;%do i=1 %to 10;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #333333;"&gt;&amp;nbsp;&amp;nbsp; libname rep&amp;amp;i. "f:\woo\dir&amp;amp;i.\test_datasets";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #333333;"&gt;data ana&amp;amp;i.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #333333;"&gt;set rep&amp;amp;i..test_check;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #333333;"&gt;if date ne (today()-2) and if _n_&amp;gt;0 then output;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #333333;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #333333;"&gt;%end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #333333;"&gt;%mend;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #333333;"&gt;%test&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Feb 2015 23:54:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182801#M14004</guid>
      <dc:creator>woo</dc:creator>
      <dc:date>2015-02-27T23:54:48Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help please</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182802#M14005</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One definite syntax error will come from:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #333333;"&gt;if date ne (today()-2) and if _n_&amp;gt;0 then output;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #333333;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #333333;"&gt;if date ne (today()-2) and _n_&amp;gt;0 then output;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #333333;"&gt;will work better&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #333333;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Feb 2015 00:03:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182802#M14005</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2015-02-28T00:03:31Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help please</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182803#M14006</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;in this case,&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #333333; font-size: 13px; background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;if date ne (today()-2) and _n_&amp;gt;0 then output;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;it is giving me all 10 datasets with zero obs. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Actually i want output only if date value (which is &lt;STRONG&gt;Wed,Feb25,2015&lt;/STRONG&gt;) is less than 2 days back&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Feb 2015 00:17:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182803#M14006</guid>
      <dc:creator>woo</dc:creator>
      <dc:date>2015-02-28T00:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help please</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182804#M14007</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I understand you correctly would this do what you want - only dates more recent than 2 days ago will be output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #333333; font-size: 13px; background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;if date &amp;gt; (today()-2) and _n_&amp;gt;0 then output;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Feb 2015 00:30:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182804#M14007</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2015-02-28T00:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help please</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182805#M14008</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually, what is the point of the _n_&amp;nbsp; &amp;gt; 0 part?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;_n_ is an counter for how many times the data step loop has iterated.&amp;nbsp; In your example, it will always be &amp;gt; 0. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are trying to implement Reeza's suggestion, that won't do it.&amp;nbsp; You would need an %IF statement (as he mentioned), to test whether or not there are 0 records that meet your criterion, and then only generate the data step code if there are &amp;gt; 0 records.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Feb 2015 00:33:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182805#M14008</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2015-02-28T00:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help please</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182806#M14009</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #333333; background-color: #ffffff;"&gt;&lt;STRONG&gt;I, too, don't understand why you are using _n_.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #333333; background-color: #ffffff;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #333333; background-color: #ffffff;"&gt;&lt;STRONG&gt;Do you really want (?):&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #333333; background-color: #ffffff;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #333333; background-color: #ffffff;"&gt;&lt;STRONG&gt;if date ge (today()-2) then output;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Feb 2015 00:40:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182806#M14009</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2015-02-28T00:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help please</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182807#M14010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First of all appreciate your time to help me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;Actually it is still giving me all 10 datasets from 10 directories with zero observation on it. &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me conform i have "&lt;STRONG style="color: #333333; font-size: 13px; background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;test_check&lt;/STRONG&gt;" dataset in 10 different directory with one variable "&lt;STRONG&gt;date&lt;/STRONG&gt;" which has value "&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Wed, Feb25, 2015". &lt;/STRONG&gt;For now i have same value for all datasets so basically output of above code logic would be nothing- none dataset should be created since "if" condition is not satisfying.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is this help?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Feb 2015 00:44:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182807#M14010</guid>
      <dc:creator>woo</dc:creator>
      <dc:date>2015-02-28T00:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help please</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182808#M14011</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, if you only have one date in your data "&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Wed, Feb25, 2015" &lt;/STRONG&gt;and you run your SAS program on 28 Feb then that is 3 days ago and you will get no data. I assume your real data will have varying dates otherwise there is no point trying to select on date as you would always get all observations or no observations - unless that is what you want.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Feb 2015 01:08:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182808#M14011</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2015-02-28T01:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help please</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182809#M14012</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm confused! You said that "&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;So Date is a character string, is that what you are saying? - date variable is date type data of-course"&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;in SAS it can only be character or numeric. Which is it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Feb 2015 01:29:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182809#M14012</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2015-02-28T01:29:08Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help please</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182810#M14013</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To avoid generating all 10 datasets, you need to use a macro %IF to control generation of the each data set, depending on whether or not there are any records.&lt;/P&gt;&lt;P&gt;Jack Hamilton wrote a really nice paper on function-style macros that count the number of a records in a dataset.&amp;nbsp; &lt;A href="http://www2.sas.com/proceedings/sugi26/p095-26.pdf"&gt;http://www2.sas.com/proceedings/sugi26/p095-26.pdf&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;You can use his %MTANYOBS macro in your setting, like:&lt;/P&gt;&lt;PRE&gt;%macro test(nData);
&amp;nbsp; %local i;
&amp;nbsp; %do i=1 %to &amp;amp;nData;
&amp;nbsp;&amp;nbsp;&amp;nbsp; %if %mtanyobs(data=rep&amp;amp;i.(where=(date ne (today()-2)))) %then %do;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data ana&amp;amp;i ;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set rep&amp;amp;i ;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if date ne (today()-2) then output ;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;
&amp;nbsp;&amp;nbsp;&amp;nbsp; %end;
&amp;nbsp; %end;
%mend;

data rep1;
&amp;nbsp; date=today();output;
&amp;nbsp; date=today()-1;output;
run;
data rep2;
&amp;nbsp; date=today()-2;output;
&amp;nbsp; date=today()-2;output;
run;
data rep3;
&amp;nbsp; date=today()-2;output;
&amp;nbsp; date=today()+1;output;
run;
 
%test(nData=3)
&lt;/PRE&gt;&lt;P&gt;So that macro call will generate ana1 (with 2 obs) and ana3 (with 1 obs), but it will NOT generate ana2 (with 0 obs), because rep2 had 0 records that satisfied the where= option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps,&lt;/P&gt;&lt;P&gt;--Q.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Feb 2015 02:01:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182810#M14013</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2015-02-28T02:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help please</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182811#M14014</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Arthur - its "date" type with weekdate17. format&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@SASKIWI -&amp;nbsp; I am running code today, 27th Feb and value for "date" variable in dataset is &lt;SPAN style="line-height: 1.5em; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;"&lt;/SPAN&gt;&lt;STRONG style="line-height: 1.5em; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Wed, Feb25, 2015" &lt;/STRONG&gt;so only 2 days back and not 3 days ago.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Feb 2015 07:52:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182811#M14014</guid>
      <dc:creator>woo</dc:creator>
      <dc:date>2015-02-28T07:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help please</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182812#M14015</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you zip and post one of your files. That would definitely make is easier for folks here to figure out what the problem is.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Feb 2015 14:57:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-help-please/m-p/182812#M14015</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2015-02-28T14:57:39Z</dc:date>
    </item>
  </channel>
</rss>

