<?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: Merge in= value comparison in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Merge-in-value-comparison/m-p/217426#M40046</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The x.y notation in the data step is used for objects (eg the hash object). No object a or b has been declared in this data step (that's why you get the error message), but you have the two variables a and b which will hold the value of 1 (true) if a matching observation is present from the respective dataset.&lt;/P&gt;&lt;P&gt;Note that if the variable prod is present in both datasets, it will exist only ONCE in the data step and be filled with the most recently read value from either dataset. Making distinctions like a.prod or b.prod is SQL syntax only valid in proc sql when you assign the aliases a and b to input datasets.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 May 2015 10:41:16 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2015-05-20T10:41:16Z</dc:date>
    <item>
      <title>Merge in= value comparison</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-in-value-comparison/m-p/217424#M40044</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is the equivalent SAS code for the code below? Any help is greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data hh_prods;&lt;/P&gt;&lt;P&gt;merge nodups_hhlevel_data (in=a) dups_hhlevel_data(in=b);&lt;/P&gt;&lt;P&gt;by name1 ADDRESS zip account_id;&lt;/P&gt;&lt;P&gt;if a.prod = b.prod then &lt;/P&gt;&lt;P&gt;prod_code=1;&lt;/P&gt;&lt;P&gt;else prod_code+1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I ran this code I got error as follows. Ideally I need to compare values of the variable 'prod' in both the tables before generating the variable '&lt;SPAN style="font-size: 13.3333330154419px;"&gt;prod_code'.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;24&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data hh_prods;&lt;/P&gt;&lt;P&gt;25&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge nodups_hhlevel_data (in=a) dups_hhlevel_data(in=b);&lt;/P&gt;&lt;P&gt;26&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by name1 ADDRESS zip account_id;&lt;/P&gt;&lt;P&gt;27&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if a.prod = b.prod then&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; ___________&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; 557&lt;/P&gt;&lt;P&gt;ERROR: DATA STEP Component Object failure.&amp;nbsp; Aborted during the COMPILATION phase.&lt;/P&gt;&lt;P&gt;ERROR 557-185: Variable a is not an object.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 May 2015 09:51:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-in-value-comparison/m-p/217424#M40044</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2015-05-20T09:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: Merge in= value comparison</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-in-value-comparison/m-p/217425#M40045</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That is SAS code.&amp;nbsp; You cannot use a.variable notation like that, also a dataset will throw warnings if same variables appear in both inputs.&amp;nbsp; I would change your code to look like:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data hh_prods;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge nodups_hhlevel_data dups_hhlevel_data (rename=(prod=b_prod));&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by name1 ADDRESS zip account_id;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if prod = b_prod then &lt;SPAN style="line-height: 1.5em;"&gt;prod_code=1;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else prod_code+1;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 May 2015 10:23:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-in-value-comparison/m-p/217425#M40045</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-05-20T10:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: Merge in= value comparison</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-in-value-comparison/m-p/217426#M40046</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The x.y notation in the data step is used for objects (eg the hash object). No object a or b has been declared in this data step (that's why you get the error message), but you have the two variables a and b which will hold the value of 1 (true) if a matching observation is present from the respective dataset.&lt;/P&gt;&lt;P&gt;Note that if the variable prod is present in both datasets, it will exist only ONCE in the data step and be filled with the most recently read value from either dataset. Making distinctions like a.prod or b.prod is SQL syntax only valid in proc sql when you assign the aliases a and b to input datasets.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 May 2015 10:41:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-in-value-comparison/m-p/217426#M40046</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-05-20T10:41:16Z</dc:date>
    </item>
    <item>
      <title>Re: Merge in= value comparison</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-in-value-comparison/m-p/217427#M40047</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;you can also use below code .&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;data hh_prods;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;merge nodups_hhlevel_data (in=a) dups_hhlevel_data(in=b);&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;by name1 ADDRESS zip account_id;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;if a and b then &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;prod_code=1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;else prod_code+1;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 May 2015 12:57:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-in-value-comparison/m-p/217427#M40047</guid>
      <dc:creator>naveen20jan</dc:creator>
      <dc:date>2015-05-20T12:57:51Z</dc:date>
    </item>
  </channel>
</rss>

