<?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 vs where in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/if-vs-where/m-p/405802#M98744</link>
    <description>&lt;P&gt;The WHERE statement filters the records that are retrieve from the input datasets.&lt;/P&gt;
&lt;P&gt;The IF statement is applied to the current data that is in the data step, so it is applied to the data after it has already been merged.&lt;/P&gt;
&lt;P&gt;Make the two subsets first and then merge them to see whey the WHERE dataset has missing values.&lt;/P&gt;
&lt;P&gt;Also make the merge without either the WHERE or IF statement and then run a separate step to filter.&lt;/P&gt;</description>
    <pubDate>Thu, 19 Oct 2017 23:19:45 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2017-10-19T23:19:45Z</dc:date>
    <item>
      <title>if vs where</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-vs-where/m-p/405798#M98742</link>
      <description>&lt;P&gt;Hello, I am a student in a SAS programming class and I was given this problem to examine the difference between the 'WHERE' and 'IF' statements. I am only allowed to edit the datalines in hopes of accomplishing the following guidelines:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Replace​ ​the​ ​gaps​ ​marked​ ​by​ ​triangles​ ​∆1​ ​and ∆2​ ​with​ ​lines​ ​of​ ​data​ ​so​ ​that:&lt;/P&gt;&lt;P&gt;● the​ ​data​ ​sets​ ​DS1​ ​and​ ​DS2​ ​each​ ​have​ ​exactly​ ​four​ ​observations​ ​and​ ​no​ ​missing​ ​values;&lt;/P&gt;&lt;P&gt;● the​ ​data​ ​set​ ​DS_Where​ ​has​ ​exactly​ ​one​ ​observation​ ​for​ ​each​ ​value​ ​w​ ​=​ ​1,​ ​2,​ ​3,​ ​4,​ ​5,​ ​which appear​ ​in​ ​that​ ​order.&lt;/P&gt;&lt;P&gt;● Design​ ​your​ ​data​ ​sets​ ​so​ ​that​ ​the​ ​program’s​ ​output​ ​shows​ ​the​ ​following​ ​properties:&lt;/P&gt;&lt;P&gt;● the​ ​w​ ​=​ ​1​ ​observations​ ​are​ ​identical​ ​in​ ​DS_Where​ ​and​ ​DS_If,​ ​with​ ​no​ ​missing​ ​values;&lt;/P&gt;&lt;P&gt;● the​ ​w​ ​=​ ​2​ ​observations​ ​are​ ​identical​ ​in​ ​DS_Where​ ​and​ ​DS_If,​ ​with​ ​a​ ​missing​ ​value​ ​for​ ​y;&lt;/P&gt;&lt;P&gt;● the​ ​w​ ​=​ ​3​ ​observations​ ​are​ ​identical​ ​in​ ​DS_Where​ ​and​ ​DS_If,​ ​with​ ​a​ ​missing​ ​value​ ​for​ ​z;&lt;/P&gt;&lt;P&gt;● DS_Where​ ​has​ ​a​ ​w​ ​=​ ​4​ ​observation​ ​with​ ​at​ ​least​ ​one​ ​missing​ ​value,​ ​but​ ​the​ ​w​ ​=​ ​4 observation​ ​in​ ​DS_If​ ​has​ ​no​ ​missing​ ​values;&lt;/P&gt;&lt;P&gt;● DS_If​ ​has​ ​no​ ​observation​ ​with​ ​w​ ​=​ ​5. A​ ​copy​ ​of​ ​the​ ​program​ ​(​where_if.sas​)​ ​can​ ​be​ ​downloaded​ ​with​ ​this​ ​assignment​ ​on​ ​Canvas. You​ ​may​ ​not​ ​change​ ​any​ ​aspect​ ​of​ ​the​ ​program​ ​except​ ​for​ ​inserting​ ​data​ ​as​ ​specified​ ​above. Please​ ​turn​ ​in​ ​the​ ​printed​ ​output​ ​on​ ​a​ ​single​ ​page​ ​along​ ​with​ ​a​ ​snippet​ ​of​ ​your​ ​data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The numbers in the datalines are my current input which yields a 'DS_WHERE' table with the correct output satisfying all the guidelines however, my 'DS_IF' table is missing the values for which 'DS2' has an x&amp;lt;5 and I do not understand how I get the missing value numbers for the 'DS_IF' table. Any help or explanation would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 23:05:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-vs-where/m-p/405798#M98742</guid>
      <dc:creator>rla21602</dc:creator>
      <dc:date>2017-10-19T23:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: if vs where</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-vs-where/m-p/405800#M98743</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data DS1;
	input w x y;
	datalines;
1	1	1
2	5	2
3	3	3
4	5	4
5	5	5
;
run;

data DS2;
	input w x z;
	datalines;
1	1	1
2	2	2
3	5	3
4	4	4
5	5	5
;
run;

data DS_Where;
	merge DS1 DS2;
	by w;
	where x&amp;lt;5;
run;

data DS_If;
	merge DS1 DS2;
	by w;
	if x&amp;lt;5;
run;

proc print data=DS1 noobs;
	title "First data set";
run;
proc print data=DS2 noobs;
	title "Second data set";
run;
proc print data=DS_Where noobs;
	title "Merged with WHERE";
run;
proc print data=DS_If noobs;
	title "Merged with IF";
run;
&lt;BR /&gt;SAS Output&lt;/CODE&gt;&lt;/PRE&gt;&lt;DIV class="branch"&gt;&lt;TABLE border="0" cellspacing="1" cellpadding="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Merged with WHERE&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;w x y z &lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;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/DIV&gt;</description>
      <pubDate>Thu, 19 Oct 2017 23:09:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-vs-where/m-p/405800#M98743</guid>
      <dc:creator>rla21602</dc:creator>
      <dc:date>2017-10-19T23:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: if vs where</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-vs-where/m-p/405802#M98744</link>
      <description>&lt;P&gt;The WHERE statement filters the records that are retrieve from the input datasets.&lt;/P&gt;
&lt;P&gt;The IF statement is applied to the current data that is in the data step, so it is applied to the data after it has already been merged.&lt;/P&gt;
&lt;P&gt;Make the two subsets first and then merge them to see whey the WHERE dataset has missing values.&lt;/P&gt;
&lt;P&gt;Also make the merge without either the WHERE or IF statement and then run a separate step to filter.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 23:19:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-vs-where/m-p/405802#M98744</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-10-19T23:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: if vs where</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-vs-where/m-p/405842#M98750</link>
      <description>&lt;P&gt;Search lexjansen.com and you’ll find many papers written on this in detail.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Oct 2017 00:54:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-vs-where/m-p/405842#M98750</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-10-20T00:54:09Z</dc:date>
    </item>
  </channel>
</rss>

