<?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: Comparing one dataset with another without merging (with the help of macro) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Comparing-one-dataset-with-another-without-merging-with-the-help/m-p/181482#M34611</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"Macro only" is almost never the answer when he problem involves manipulation of data.&amp;nbsp; For that you need to use data steps and procedures.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is certainly one of those cases and you should have told them such.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Dec 2013 15:42:07 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2013-12-24T15:42:07Z</dc:date>
    <item>
      <title>Comparing one dataset with another without merging (with the help of macro)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-one-dataset-with-another-without-merging-with-the-help/m-p/181476#M34605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Hi All&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;I have an interview question to get an answer for. The only condition is we are not to use merging for the following and to do it with the help of macros only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG&gt;Question:&lt;/STRONG&gt; There are two datasets. One is having Subject and visit, other is having visit only.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P&gt;data t;&lt;/P&gt;&lt;P&gt;input subject visit @@;&lt;/P&gt;&lt;P&gt;datalines ;&lt;/P&gt;&lt;P&gt;001 1 001 2 001 3 001 8 002 1 002 8&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;data r;&lt;/P&gt;&lt;P&gt;input&amp;nbsp; visit @@;&lt;/P&gt;&lt;P&gt;datalines ;&lt;/P&gt;&lt;P&gt;1 2 3 4 5 6 7 8&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want another dataset which will compare the visit from first dataset to the second dataset and will give the missing visits in new variable, one observation for each missing visit for each subject. Following is the example of final output required:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;subject visit missingvisit&lt;/P&gt;&lt;P&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;/P&gt;&lt;P&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&lt;/P&gt;&lt;P&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&lt;/P&gt;&lt;P&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&lt;/P&gt;&lt;P&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&lt;/P&gt;&lt;P&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;Reminder&lt;/STRONG&gt;&lt;/SPAN&gt; - not to use the merging&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks everyone &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Dec 2013 09:11:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-one-dataset-with-another-without-merging-with-the-help/m-p/181476#M34605</guid>
      <dc:creator>JatinBansal</dc:creator>
      <dc:date>2013-12-24T09:11:51Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing one dataset with another without merging (with the help of macro)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-one-dataset-with-another-without-merging-with-the-help/m-p/181477#M34606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since you have mentioned using Macros only, I'd think of using &lt;STRONG&gt;CALL SYMPUT&lt;/STRONG&gt; to place your variable values into a macro variable and call the same(key variable) using &lt;STRONG&gt;SYMGET function. &lt;/STRONG&gt;I'd suggest do it in two steps for easy understanding. The syntax is pretty simple as I am sure you would have noticed in support.sas.com.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Naveen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Dec 2013 10:44:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-one-dataset-with-another-without-merging-with-the-help/m-p/181477#M34606</guid>
      <dc:creator>NaveenSrinivasan</dc:creator>
      <dc:date>2013-12-24T10:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing one dataset with another without merging (with the help of macro)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-one-dataset-with-another-without-merging-with-the-help/m-p/181478#M34607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't know what macro will bring to this party.&amp;nbsp; I like the features of PROC SUMMARY for this.&amp;nbsp; If you have other variables in T as you surely would you can use IDGROUP to pass then through.&lt;/P&gt;&lt;DIV style="font-family: Courier New; font-size: 9pt;"&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;data&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; t;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; subject visit @@;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; y = ranuni(&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; y2 = sqrt(y);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;datalines&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffc0;"&gt;001 1 001 2 001 3 001 8 002 1 002 8&lt;BR /&gt;&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;data&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; r;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; visit @@;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;datalines&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffc0;"&gt;1 2 3 4 5 6 7 8&lt;BR /&gt;&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;summary&lt;/STRONG&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;t&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;classdata&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=r &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;nway&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; subject;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;class&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; visit;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;output&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=allvis(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;drop&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=_type_) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;idgroup&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;(Y:)=);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;print&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Dec 2013 11:20:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-one-dataset-with-another-without-merging-with-the-help/m-p/181478#M34607</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2013-12-24T11:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing one dataset with another without merging (with the help of macro)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-one-dataset-with-another-without-merging-with-the-help/m-p/181479#M34608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Naveen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Me and my friend (who was asked this question) also thought that this is very simple &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We were on the same track which you suggests i.e. call symput and symget. But can u please give the exact code, how it will take place....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Dec 2013 11:56:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-one-dataset-with-another-without-merging-with-the-help/m-p/181479#M34608</guid>
      <dc:creator>JatinBansal</dc:creator>
      <dc:date>2013-12-24T11:56:49Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing one dataset with another without merging (with the help of macro)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-one-dataset-with-another-without-merging-with-the-help/m-p/181480#M34609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi data_null_&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The method you provided, as i understood created a flag and after this it is simple. But the first thing to it is to use the macro. I tried to use call symput to put each value in a macro variable then i got stuck on how to compare it like vlookup.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I appreciate your effort on this. But we need to do this by macro only, this time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Dec 2013 12:02:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-one-dataset-with-another-without-merging-with-the-help/m-p/181480#M34609</guid>
      <dc:creator>JatinBansal</dc:creator>
      <dc:date>2013-12-24T12:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing one dataset with another without merging (with the help of macro)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-one-dataset-with-another-without-merging-with-the-help/m-p/181481#M34610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The first rule of macro programming in SAS; is to learn when you don't need it or perhaps more importantly when you don't want to use it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Dec 2013 12:08:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-one-dataset-with-another-without-merging-with-the-help/m-p/181481#M34610</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2013-12-24T12:08:39Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing one dataset with another without merging (with the help of macro)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-one-dataset-with-another-without-merging-with-the-help/m-p/181482#M34611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"Macro only" is almost never the answer when he problem involves manipulation of data.&amp;nbsp; For that you need to use data steps and procedures.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is certainly one of those cases and you should have told them such.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Dec 2013 15:42:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-one-dataset-with-another-without-merging-with-the-help/m-p/181482#M34611</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-12-24T15:42:07Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing one dataset with another without merging (with the help of macro)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-one-dataset-with-another-without-merging-with-the-help/m-p/181483#M34612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In a similar trend to DN and Tom,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Had I been asked this question in an interview with my current knowledge of SAS, my answer would be straight forward:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will assume this is a trick question. Whether this can be achieved or not through macros is irrelevant, there are significantly better and more efficient tools for this task than macros and in particular, any macro strict solution for this task should be avoided.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As for a bad answer to a trick question for the sole sake of showing skills with SAS macros,&lt;/P&gt;&lt;P&gt;%macro really();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select distinct subject&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; into :subj1-:subj999999&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from t&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let nbyvar=&amp;amp;sqlobs;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set t;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call symput(cats('visit', '_', subject, '_', visit), '0'); /* the actual value put in the macro var is irrelevant we only need it to exist. */&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select visit&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; into :v1-:v999999&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from r&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let nvisit=&amp;amp;sqlobs;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%do i=1 %to &amp;amp;nbyvar;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %do j=1 %to &amp;amp;nvisit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %if %symexist(visit_&amp;amp;i._&amp;amp;j.) %then %do;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; subject="&amp;amp;i.";&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; visit=&amp;amp;j.;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; missingvisit=.;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %end; %else %do;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; subject="&amp;amp;i.";&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; visit=.;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; missingvisit=&amp;amp;j.;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %end;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%really();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Don't get me wrong, it's rarely the best choice to talk against a question but if the rationale as to why macros shouldn't be used to solve this is accompanied by something like "but I assume this is merely for the sake of seeing if I am comfortable with handling macro variable and logic", then here's an example solution that uses right about as much macros as can be. It is probably wiser to demonstrate to the interviewer that not only do you know macro wells but also know when not to macro at the same time~&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Vince&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Dec 2013 16:14:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-one-dataset-with-another-without-merging-with-the-help/m-p/181483#M34612</guid>
      <dc:creator>Vince28_Statcan</dc:creator>
      <dc:date>2013-12-24T16:14:09Z</dc:date>
    </item>
  </channel>
</rss>

