<?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: where statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/where-statement/m-p/462066#M117564</link>
    <description>&lt;P&gt;Here are examples using both if and where:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input country $;
  cards;
US
Mexico
Canada
1st nation of tribes
;

data want;
  set have;
  if  rank(upcase(first(country))) in ( 65:90);
run;

data want;
  set have (where=(rank(upcase(first(country))) in ( 65:90)));
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 14 May 2018 14:46:17 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2018-05-14T14:46:17Z</dc:date>
    <item>
      <title>where statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/where-statement/m-p/462056#M117559</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;I want to subset a dataset either using IF or Where statement.&lt;/P&gt;&lt;P&gt;But I have multiple values such that it will be difficult to type them all out.&lt;/P&gt;&lt;P&gt;Example,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;if&amp;nbsp;&amp;nbsp;country in ( "a-z"); (not sure if I can use where instead of if here)&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I write a syntax without typing a,b,c,.....z (character values for variable country)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 May 2018 14:25:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/where-statement/m-p/462056#M117559</guid>
      <dc:creator>avepo</dc:creator>
      <dc:date>2018-05-14T14:25:16Z</dc:date>
    </item>
    <item>
      <title>Re: where statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/where-statement/m-p/462058#M117560</link>
      <description>&lt;P&gt;You can reverse the logic here and compress out values like alphabetic easily, then see if the length is still &amp;gt; 0, e.g.&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  if lengthn(compress(country," ","a"))=0;
run;&lt;/PRE&gt;
&lt;P&gt;So, take all the alphabetic characters out of country, then if the length is zero you know it was only those.&lt;/P&gt;</description>
      <pubDate>Mon, 14 May 2018 14:31:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/where-statement/m-p/462058#M117560</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-05-14T14:31:00Z</dc:date>
    </item>
    <item>
      <title>Re: where statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/where-statement/m-p/462062#M117563</link>
      <description>&lt;P&gt;It doesn't matter if you use IF vs. WHERE.&amp;nbsp; Either way "a-z" is not something that SAS will interpret correctly.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where is the list of acceptable country names right now?&amp;nbsp; On a piece of paper?&amp;nbsp; In your head?&amp;nbsp; In another data set?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Will the data contain all lowercase letters?&amp;nbsp; Initial caps?&amp;nbsp; Upper case only?&amp;nbsp; Will it vary from data set to data set?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Those are the questions you need to address before starting to write a program.&lt;/P&gt;</description>
      <pubDate>Mon, 14 May 2018 14:39:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/where-statement/m-p/462062#M117563</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-05-14T14:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: where statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/where-statement/m-p/462066#M117564</link>
      <description>&lt;P&gt;Here are examples using both if and where:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input country $;
  cards;
US
Mexico
Canada
1st nation of tribes
;

data want;
  set have;
  if  rank(upcase(first(country))) in ( 65:90);
run;

data want;
  set have (where=(rank(upcase(first(country))) in ( 65:90)));
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 May 2018 14:46:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/where-statement/m-p/462066#M117564</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-05-14T14:46:17Z</dc:date>
    </item>
    <item>
      <title>Re: where statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/where-statement/m-p/462351#M117707</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt;&amp;nbsp; NOTALPHA() is good .&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input country $40.;
  cards;
US
Mexico
Canada
1st nation of tribes
;

data want;
  set have;
  if notalpha(country)=1;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 May 2018 13:48:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/where-statement/m-p/462351#M117707</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-05-15T13:48:47Z</dc:date>
    </item>
  </channel>
</rss>

