<?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 Logical Problem in SAS Code in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Logical-Problem-in-SAS-Code/m-p/433072#M28005</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;i wanted to solve a problem but i am little bit confuse as i am learning SAS.&lt;/P&gt;&lt;P&gt;Here is the algorithm of my code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data operation;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; set rule_data;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if satisfy condition then&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; do;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; set data_value ;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if match_condition_of_rule_data_with_data_value then;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&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; peform opeartion on data_value based on rule_data;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when i am trying this,it gives me combine data set and not giving result as i expected as i want value from rule_data_set only and both dataset have different number of observations and variables.&lt;/P&gt;</description>
    <pubDate>Thu, 01 Feb 2018 12:00:42 GMT</pubDate>
    <dc:creator>ramanandyadav</dc:creator>
    <dc:date>2018-02-01T12:00:42Z</dc:date>
    <item>
      <title>Logical Problem in SAS Code</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Logical-Problem-in-SAS-Code/m-p/433072#M28005</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;i wanted to solve a problem but i am little bit confuse as i am learning SAS.&lt;/P&gt;&lt;P&gt;Here is the algorithm of my code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data operation;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; set rule_data;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if satisfy condition then&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; do;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; set data_value ;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if match_condition_of_rule_data_with_data_value then;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&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; peform opeartion on data_value based on rule_data;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when i am trying this,it gives me combine data set and not giving result as i expected as i want value from rule_data_set only and both dataset have different number of observations and variables.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2018 12:00:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Logical-Problem-in-SAS-Code/m-p/433072#M28005</guid>
      <dc:creator>ramanandyadav</dc:creator>
      <dc:date>2018-02-01T12:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: Logical Problem in SAS Code</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Logical-Problem-in-SAS-Code/m-p/433083#M28007</link>
      <description>&lt;P&gt;You might want to use a merge instead, it is not possible (at least in an easy fashion) to have multiple datasets open at the samt time in a data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;data operation;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; merge rule_data&lt;/STRONG&gt;&lt;STRONG&gt;&amp;nbsp;data_value ;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; by common_key;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if match_condition_of_rule_data_with_data_value then;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&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; peform opeartion on data_value based on rule_data;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;//Fredrik&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2018 12:34:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Logical-Problem-in-SAS-Code/m-p/433083#M28007</guid>
      <dc:creator>FredrikE</dc:creator>
      <dc:date>2018-02-01T12:34:58Z</dc:date>
    </item>
    <item>
      <title>Re: Logical Problem in SAS Code</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Logical-Problem-in-SAS-Code/m-p/433095#M28009</link>
      <description>&lt;P&gt;There are numerous ways to do this, generate the code from the rule dataset is one that jumps to mind, merging another .&amp;nbsp; So something like:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  set rule_data;
  call execute(...);
run;&lt;/PRE&gt;
&lt;P&gt;Note I can't provide working code as you have shown no test data in the form of a datastep.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2018 12:59:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Logical-Problem-in-SAS-Code/m-p/433095#M28009</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-02-01T12:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: Logical Problem in SAS Code</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Logical-Problem-in-SAS-Code/m-p/433145#M28012</link>
      <description>&lt;P&gt;Well, we're making assumptions based on the pseudocode you provided, but it would be better to actually provide sample data and code that we can work off&amp;nbsp; and see more easily what you want.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My first instinct is to say that what you're doing isn't possible...at least easily...but there are ways. It would be better if you first explained in detail what you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/188541"&gt;@ramanandyadav&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i wanted to solve a problem but i am little bit confuse as i am learning SAS.&lt;/P&gt;
&lt;P&gt;Here is the algorithm of my code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;data operation;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; set rule_data;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if satisfy condition then&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; do;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; set data_value ;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if match_condition_of_rule_data_with_data_value then;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&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; peform opeartion on data_value based on rule_data;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;when i am trying this,it gives me combine data set and not giving result as i expected as i want value from rule_data_set only and both dataset have different number of observations and variables.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2018 15:55:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Logical-Problem-in-SAS-Code/m-p/433145#M28012</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-02-01T15:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: Logical Problem in SAS Code</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Logical-Problem-in-SAS-Code/m-p/433316#M28027</link>
      <description>&lt;P&gt;As the other contributors have said a merge may be your best bet - alternatively an SQL join might also be able to do what you what which you may find easier if you come from an SQL background.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2018 23:12:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Logical-Problem-in-SAS-Code/m-p/433316#M28027</guid>
      <dc:creator>ChrisBrooks</dc:creator>
      <dc:date>2018-02-01T23:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: Logical Problem in SAS Code</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Logical-Problem-in-SAS-Code/m-p/433408#M28033</link>
      <description>&lt;P&gt;Hi FredrikE,,&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;As i mentioned&amp;nbsp;&lt;SPAN&gt;both data set&amp;nbsp;have different number of observations and variables. suppose&amp;nbsp;&lt;STRONG&gt;rule_data&amp;nbsp;&lt;/STRONG&gt;has only 50 observations and&amp;nbsp;&lt;STRONG&gt;data_value&amp;nbsp;&lt;/STRONG&gt;has 2 millions observation. how is it possible to merge in such condition ? and even if it merged somehow then second challenge i have to apply observation of rule_data on &lt;STRONG&gt;data_value&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;so i need to iterate 50 times on 2 millions data but if i merge it will iterate 2 millions times it is very confusing for me to understand.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 07:05:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Logical-Problem-in-SAS-Code/m-p/433408#M28033</guid>
      <dc:creator>ramanandyadav</dc:creator>
      <dc:date>2018-02-02T07:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: Logical Problem in SAS Code</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Logical-Problem-in-SAS-Code/m-p/433428#M28035</link>
      <description>&lt;P&gt;First off, if your learning SAS this is not the the topic to start with, nor is that amount of data.&amp;nbsp; Both are for more advanced users.&amp;nbsp; If you make it harder to learn you will more likely fail.&lt;/P&gt;
&lt;P&gt;Secondly, with that kind of data, yes, merge probably isn't the way forward.&amp;nbsp; Working with big data is slightly different, hence why you should learn Base SAS thoroughly before moving onto more advanced topics.&lt;/P&gt;
&lt;P&gt;As I posted, you can generate the necessary code:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  set rule_data end=last;&lt;BR /&gt;  if _n_=1 then call execute('data want; set have;');
  call execute(rule);&lt;BR /&gt;  if last then call execute('run;');
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;However it is highly unlikely you will understand what is being done here if you are learning SAS.&amp;nbsp; What this will do is create a datastep statement after this one has finished, which has the rule statement for each observation from rule table.&amp;nbsp; That generated code is then run.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 08:54:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Logical-Problem-in-SAS-Code/m-p/433428#M28035</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-02-02T08:54:57Z</dc:date>
    </item>
  </channel>
</rss>

