<?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 Statements Problem: How to keep more? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/IF-Statements-Problem-How-to-keep-more/m-p/410754#M100375</link>
    <description>&lt;P&gt;Thank you. This is very clean and simple&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 06 Nov 2017 04:07:50 GMT</pubDate>
    <dc:creator>audreyliu201</dc:creator>
    <dc:date>2017-11-06T04:07:50Z</dc:date>
    <item>
      <title>IF Statements Problem: How to keep more?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-Statements-Problem-How-to-keep-more/m-p/410751#M100372</link>
      <description>&lt;P&gt;data west;&lt;BR /&gt;set x;&lt;BR /&gt;IF no="04";&lt;BR /&gt;IF no="21";&lt;BR /&gt;IF no="23";&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is a variable NO. I would like to keep no=04, no=21 and no=23 at the same time.&lt;/P&gt;&lt;P&gt;However, This code doesn't work.&lt;/P&gt;&lt;P&gt;Besides, I run it one by one and then set together. Is there any other way else to do it?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2017 03:35:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-Statements-Problem-How-to-keep-more/m-p/410751#M100372</guid>
      <dc:creator>audreyliu201</dc:creator>
      <dc:date>2017-11-06T03:35:23Z</dc:date>
    </item>
    <item>
      <title>Re: IF Statements Problem: How to keep more?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-Statements-Problem-How-to-keep-more/m-p/410753#M100374</link>
      <description>&lt;P&gt;&lt;FONT face="courier new,courier"&gt;if NO = '04';&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;is the same as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;if NO ne '04' then delete;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;It means: only keep if NO='04' .&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You want&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;if NO in ('04','21','23');&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2017 04:05:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-Statements-Problem-How-to-keep-more/m-p/410753#M100374</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-11-06T04:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: IF Statements Problem: How to keep more?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-Statements-Problem-How-to-keep-more/m-p/410754#M100375</link>
      <description>&lt;P&gt;Thank you. This is very clean and simple&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2017 04:07:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-Statements-Problem-How-to-keep-more/m-p/410754#M100375</guid>
      <dc:creator>audreyliu201</dc:creator>
      <dc:date>2017-11-06T04:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: IF Statements Problem: How to keep more?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-Statements-Problem-How-to-keep-more/m-p/410782#M100385</link>
      <description>&lt;P&gt;You would be better off storing those numeric values as numeric variables rather than text, unless there is a really good reason not to.&amp;nbsp; For instance, calculations, where's, joins etc. all will work better with numerics, and if you say you need the 0 where only one digit is present, then use the z2. format.&amp;nbsp; Best of both worlds then.&lt;/P&gt;
&lt;PRE&gt;if no in (4,21,23);&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Nov 2017 09:25:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-Statements-Problem-How-to-keep-more/m-p/410782#M100385</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-11-06T09:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: IF Statements Problem: How to keep more?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-Statements-Problem-How-to-keep-more/m-p/410790#M100389</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt; Good point. Another school of thought is that numeric variables should only be for values that can be used for calculations, and other values (like IDs) should be strings. Strings do need to use exact values ( '9' is not the same as ' 9' or '09' ) but this is not necessarily detrimental. I reckon the difference is just something to be aware of, not a reason to always use one or the other.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As for speed, strings can be be faster when merging.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data T1 T2;  do I=1 to 1e8-1; output; end;
data _null_; 
  merge T1 T2; by I; 
run;
*NOTE: DATA statement used (Total process time):
       real time           27.15 seconds
       user cpu time       25.14 seconds
       system cpu time     2.01 seconds;


data T1 T2;  do I=1 to 1e8-1; A=put(I,z8.);output; end; drop I;
data _null_; 
  merge T1 T2; by A; 
run;
*NOTE: DATA statement used (Total process time):
       real time           25.58 seconds
       user cpu time       23.13 seconds
       system cpu time     2.44 seconds;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2017 10:27:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-Statements-Problem-How-to-keep-more/m-p/410790#M100389</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-11-06T10:27:20Z</dc:date>
    </item>
  </channel>
</rss>

