<?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: Im trying to compare two variables and insert variable X into macro if conditions are met in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Im-trying-to-compare-two-variables-and-insert-variable-X-into/m-p/213975#M39487</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sounds like you want to create a problem report.&amp;nbsp; Typically you would include the id variables (so someone can find the offending row), then rule and the key values that violate the rule.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; length rule $50 values $50 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; keep id rule values ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if x &amp;gt; y then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rule = 'X&amp;gt;Y' ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; values=catx(' ',catx('=','X',x),catx('=','Y',y));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Jun 2015 16:39:57 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2015-06-25T16:39:57Z</dc:date>
    <item>
      <title>Im trying to compare two variables and insert variable X into macro if conditions are met</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Im-trying-to-compare-two-variables-and-insert-variable-X-into/m-p/213974#M39486</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And create another dataset and add a row to the second dataset explaining the problem with X variable, so I any number of variables/explinations would need to be added to other dataset. So I am trying to figure out how to do this in an array (IE add 3 variables to the array and then add a row for each variable to say this variable has a problem)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My dataset looks like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Variable&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;X&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Y&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;A&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;B&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;.5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the condition might be if X&amp;gt;Y then add a variable to array, and then I want to create dataset test and add a row saying variable X has X&amp;gt;Y&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this possible and does it make sense&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jun 2015 15:57:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Im-trying-to-compare-two-variables-and-insert-variable-X-into/m-p/213974#M39486</guid>
      <dc:creator>Xamius32</dc:creator>
      <dc:date>2015-06-25T15:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: Im trying to compare two variables and insert variable X into macro if conditions are met</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Im-trying-to-compare-two-variables-and-insert-variable-X-into/m-p/213975#M39487</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sounds like you want to create a problem report.&amp;nbsp; Typically you would include the id variables (so someone can find the offending row), then rule and the key values that violate the rule.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; length rule $50 values $50 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; keep id rule values ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if x &amp;gt; y then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rule = 'X&amp;gt;Y' ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; values=catx(' ',catx('=','X',x),catx('=','Y',y));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jun 2015 16:39:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Im-trying-to-compare-two-variables-and-insert-variable-X-into/m-p/213975#M39487</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-06-25T16:39:57Z</dc:date>
    </item>
  </channel>
</rss>

