<?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: If Criteria in Current Dataset and Prev Dataset then 1 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/If-Criteria-in-Current-Dataset-and-Prev-Dataset-then-1/m-p/602351#M174386</link>
    <description>&lt;P&gt;Repeating what &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt; already said: please post data showing what you have and what you expect as result. From the description it seems that you need a simple merge with some logic to mark those customers not already in the previous month table.&lt;/P&gt;</description>
    <pubDate>Thu, 07 Nov 2019 10:04:41 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2019-11-07T10:04:41Z</dc:date>
    <item>
      <title>If Criteria in Current Dataset and Prev Dataset then 1</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-Criteria-in-Current-Dataset-and-Prev-Dataset-then-1/m-p/602347#M174382</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need some logic to carry out the following requirements if possible please.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My current table (New_Orders) has the following variables&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Email&lt;/P&gt;
&lt;P&gt;Name&lt;/P&gt;
&lt;P&gt;REF&lt;/P&gt;
&lt;P&gt;Last Name&lt;/P&gt;
&lt;P&gt;Order&lt;/P&gt;
&lt;P&gt;Region&lt;/P&gt;
&lt;P&gt;Status&lt;/P&gt;
&lt;P&gt;TelNo&lt;/P&gt;
&lt;P&gt;Login_id&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I need is to create 2 new variables within this table called&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;'New_Order' &lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;and&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;'Curr_User'&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Requirements&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;New Variable 'New_Order'&lt;/STRONG&gt; = if &lt;STRONG&gt;Login_ID&lt;/STRONG&gt; is in table &lt;STRONG&gt;New_Orders&lt;/STRONG&gt; and &lt;STRONG&gt;New_Orders_Prev_Month&lt;/STRONG&gt; then 'Existing' else 'N/A'&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;New Variable 'Curr_User'&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;= if&amp;nbsp;&lt;STRONG&gt;Email&lt;/STRONG&gt; is in table &lt;STRONG&gt;New_Orders&lt;/STRONG&gt; and &lt;STRONG&gt;New_Orders_Prev_Month&lt;/STRONG&gt; then '1' else 'N/A'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 09:41:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-Criteria-in-Current-Dataset-and-Prev-Dataset-then-1/m-p/602347#M174382</guid>
      <dc:creator>KC_16</dc:creator>
      <dc:date>2019-11-07T09:41:09Z</dc:date>
    </item>
    <item>
      <title>Re: If Criteria in Current Dataset and Prev Dataset then 1</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-Criteria-in-Current-Dataset-and-Prev-Dataset-then-1/m-p/602348#M174383</link>
      <description>&lt;P&gt;Can you describe your problem with some sample data and what you want the result to look like from that data? Makes it much easier to provide a usable code answer.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 09:43:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-Criteria-in-Current-Dataset-and-Prev-Dataset-then-1/m-p/602348#M174383</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-11-07T09:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: If Criteria in Current Dataset and Prev Dataset then 1</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-Criteria-in-Current-Dataset-and-Prev-Dataset-then-1/m-p/602349#M174384</link>
      <description>&lt;P&gt;What I am trying to understand is how many &lt;STRONG&gt;existing&lt;/STRONG&gt; customers do we have (these will be captured within previous months table) that have made a new order vs newly on boarded customers (that won't exist in the previous months table).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 09:59:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-Criteria-in-Current-Dataset-and-Prev-Dataset-then-1/m-p/602349#M174384</guid>
      <dc:creator>KC_16</dc:creator>
      <dc:date>2019-11-07T09:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: If Criteria in Current Dataset and Prev Dataset then 1</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-Criteria-in-Current-Dataset-and-Prev-Dataset-then-1/m-p/602350#M174385</link>
      <description>&lt;P&gt;Ok. How big is your data?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 10:02:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-Criteria-in-Current-Dataset-and-Prev-Dataset-then-1/m-p/602350#M174385</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-11-07T10:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: If Criteria in Current Dataset and Prev Dataset then 1</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-Criteria-in-Current-Dataset-and-Prev-Dataset-then-1/m-p/602351#M174386</link>
      <description>&lt;P&gt;Repeating what &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt; already said: please post data showing what you have and what you expect as result. From the description it seems that you need a simple merge with some logic to mark those customers not already in the previous month table.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 10:04:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-Criteria-in-Current-Dataset-and-Prev-Dataset-then-1/m-p/602351#M174386</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-11-07T10:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: If Criteria in Current Dataset and Prev Dataset then 1</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-Criteria-in-Current-Dataset-and-Prev-Dataset-then-1/m-p/602352#M174387</link>
      <description>&lt;P&gt;I can't see your data, so needless to say, this is untested&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data New_Orders_1;

	if _N_=1 then do;
		declare hash h(dataset:'New_Orders_Prev_Month');
		h.definekey('Login_id');
		h.definedone();
	end;

	set New_Orders;
	
	if h.check()=0 then New_Order='Existing';
	else New_Order='N/A';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Nov 2019 10:08:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-Criteria-in-Current-Dataset-and-Prev-Dataset-then-1/m-p/602352#M174387</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-11-07T10:08:49Z</dc:date>
    </item>
  </channel>
</rss>

