<?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 compare 2 datasets observations and execute a list of command based on the result in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-datasets-observations-and-execute-a-list-of/m-p/401180#M97304</link>
    <description>&lt;P&gt;Try this....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
  select nobs into: curr from dictionary.tables
  where upcase(libname)="MYLIB" and upcase(memname)='MY_CURR';

  select nobs into: PREV from dictionary.tables
  where upcase(libname)="MYLIB" and upcase(memname)='MY_PREV';
QUIT;

%macro HasMore;
%if %eval(&amp;amp;prev&amp;lt;curr) %then %do;
  %MyMacro;
%end;

%mend

%HasMore;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
    <pubDate>Thu, 05 Oct 2017 01:21:09 GMT</pubDate>
    <dc:creator>ShiroAmada</dc:creator>
    <dc:date>2017-10-05T01:21:09Z</dc:date>
    <item>
      <title>How to compare 2 datasets observations and execute a list of command based on the result</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-datasets-observations-and-execute-a-list-of/m-p/401176#M97303</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 2 data sets (Current and Prev month).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to compare the 2 datasets no. of observations and if the current month data set has more no. of records then I need to run or call a macro?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I achieve that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2017 00:42:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-datasets-observations-and-execute-a-list-of/m-p/401176#M97303</guid>
      <dc:creator>krisraa</dc:creator>
      <dc:date>2017-10-05T00:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 datasets observations and execute a list of command based on the result</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-datasets-observations-and-execute-a-list-of/m-p/401180#M97304</link>
      <description>&lt;P&gt;Try this....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
  select nobs into: curr from dictionary.tables
  where upcase(libname)="MYLIB" and upcase(memname)='MY_CURR';

  select nobs into: PREV from dictionary.tables
  where upcase(libname)="MYLIB" and upcase(memname)='MY_PREV';
QUIT;

%macro HasMore;
%if %eval(&amp;amp;prev&amp;lt;curr) %then %do;
  %MyMacro;
%end;

%mend

%HasMore;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2017 01:21:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-datasets-observations-and-execute-a-list-of/m-p/401180#M97304</guid>
      <dc:creator>ShiroAmada</dc:creator>
      <dc:date>2017-10-05T01:21:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 datasets observations and execute a list of command based on the result</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-datasets-observations-and-execute-a-list-of/m-p/401183#M97306</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  if NOBS1 ne NOBS2 then call execute('%mymacro;');
  set TABLE1 nobs=NOBS1;
  set TABLE2 nobs=NOBS2;
  stop;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Simple since there is no macro language, and fast since we don't use the dictionary.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2017 03:53:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-datasets-observations-and-execute-a-list-of/m-p/401183#M97306</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-10-05T03:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 datasets observations and execute a list of command based on the result</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-datasets-observations-and-execute-a-list-of/m-p/401480#M97412</link>
      <description>&lt;P&gt;Thanks Chris it did the job for me....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any specific reason why the if logic before reading the data sets?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2017 18:54:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-datasets-observations-and-execute-a-list-of/m-p/401480#M97412</guid>
      <dc:creator>krisraa</dc:creator>
      <dc:date>2017-10-05T18:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 datasets observations and execute a list of command based on the result</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-datasets-observations-and-execute-a-list-of/m-p/401491#M97418</link>
      <description>&lt;P&gt;If you put it after the SET statements and one of the data sets is empty, it will never be executed.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2017 02:03:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-datasets-observations-and-execute-a-list-of/m-p/401491#M97418</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-10-06T02:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 datasets observations and execute a list of command based on the result</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-datasets-observations-and-execute-a-list-of/m-p/401583#M97456</link>
      <description>&lt;P&gt;nobs are obtained during compile time so they can be used before SET statement.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2017 02:23:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-datasets-observations-and-execute-a-list-of/m-p/401583#M97456</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2017-10-06T02:23:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 datasets observations and execute a list of command based on the result</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-datasets-observations-and-execute-a-list-of/m-p/401620#M97484</link>
      <description>&lt;P&gt;start using&amp;nbsp;Proc Compare ..&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2017 06:01:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-datasets-observations-and-execute-a-list-of/m-p/401620#M97484</guid>
      <dc:creator>ali_jooan</dc:creator>
      <dc:date>2017-10-06T06:01:03Z</dc:date>
    </item>
  </channel>
</rss>

