<?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: To select observations containing alphabets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/To-select-observations-containing-alphabets/m-p/540388#M149058</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  if lengthn(comrpess(name,".","d"))=0 then name_derived=compress(name,".","kd");
run;&lt;/PRE&gt;
&lt;P&gt;Add the dot in.&amp;nbsp; Is it that you want a numeric value?&amp;nbsp; If so:&lt;/P&gt;
&lt;PRE&gt;data have;
  a="123"; output;
  a="1.45"; output;
  a="XYZ"; output;
run;

data want;
  set have;
  if lengthn(compress(a,".","d"))=0 then b=input(a,best.);
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 05 Mar 2019 10:12:24 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2019-03-05T10:12:24Z</dc:date>
    <item>
      <title>To select observations containing alphabets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-select-observations-containing-alphabets/m-p/540378#M149050</link>
      <description>I have a dataset like&lt;BR /&gt;Id name&lt;BR /&gt;1 negative&lt;BR /&gt;2 45&lt;BR /&gt;3 1E&lt;BR /&gt;4 positive&lt;BR /&gt;5 24&lt;BR /&gt;&lt;BR /&gt;I want to derive a new variable 'Flag' in which the values having alphabets should be ' '(missing character value) and no change for others.like,&lt;BR /&gt;1&lt;BR /&gt;2 45&lt;BR /&gt;3&lt;BR /&gt;4&lt;BR /&gt;5 24&lt;BR /&gt;&lt;BR /&gt;Someone pls help..&lt;BR /&gt;Thanks</description>
      <pubDate>Tue, 05 Mar 2019 09:23:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-select-observations-containing-alphabets/m-p/540378#M149050</guid>
      <dc:creator>AKHILA</dc:creator>
      <dc:date>2019-03-05T09:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: To select observations containing alphabets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-select-observations-containing-alphabets/m-p/540379#M149051</link>
      <description>&lt;P&gt;Something like:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  if lengthn(comrpess(name," ","d"))=0 then name_derived=compress(name," ","kd");
run;&lt;/PRE&gt;
&lt;P&gt;Not tested as you have not provided test data in the form of a datastep (and not here to type in test data!).&lt;/P&gt;
&lt;P&gt;What this does is check the length when numbers are removed, if there is nothing but numbers, then keep only them.&amp;nbsp; Compress is described in the docs:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000212246.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000212246.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 09:29:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-select-observations-containing-alphabets/m-p/540379#M149051</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2019-03-05T09:29:25Z</dc:date>
    </item>
    <item>
      <title>Re: To select observations containing alphabets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-select-observations-containing-alphabets/m-p/540380#M149052</link>
      <description>Its working what to do if i want decimal digits also like 4.2 , 1.8 etc&lt;BR /&gt;</description>
      <pubDate>Tue, 05 Mar 2019 09:36:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-select-observations-containing-alphabets/m-p/540380#M149052</guid>
      <dc:creator>AKHILA</dc:creator>
      <dc:date>2019-03-05T09:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: To select observations containing alphabets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-select-observations-containing-alphabets/m-p/540387#M149057</link>
      <description>&lt;P&gt;As already requested, POST EXAMPLE DATA IN A DATA STEP!!&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 10:11:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-select-observations-containing-alphabets/m-p/540387#M149057</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-03-05T10:11:03Z</dc:date>
    </item>
    <item>
      <title>Re: To select observations containing alphabets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-select-observations-containing-alphabets/m-p/540388#M149058</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  if lengthn(comrpess(name,".","d"))=0 then name_derived=compress(name,".","kd");
run;&lt;/PRE&gt;
&lt;P&gt;Add the dot in.&amp;nbsp; Is it that you want a numeric value?&amp;nbsp; If so:&lt;/P&gt;
&lt;PRE&gt;data have;
  a="123"; output;
  a="1.45"; output;
  a="XYZ"; output;
run;

data want;
  set have;
  if lengthn(compress(a,".","d"))=0 then b=input(a,best.);
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 10:12:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-select-observations-containing-alphabets/m-p/540388#M149058</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2019-03-05T10:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: To select observations containing alphabets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-select-observations-containing-alphabets/m-p/540405#M149070</link>
      <description>What should happen when NAME contains blanks such as "7 11"&lt;BR /&gt;&lt;BR /&gt;I'm guessing that should be removed.  In that case, you can try:&lt;BR /&gt;&lt;BR /&gt;if input( name, ?? 32.) &amp;gt; . then flag = name;</description>
      <pubDate>Tue, 05 Mar 2019 11:13:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-select-observations-containing-alphabets/m-p/540405#M149070</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-03-05T11:13:11Z</dc:date>
    </item>
    <item>
      <title>Re: To select observations containing alphabets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-select-observations-containing-alphabets/m-p/540415#M149080</link>
      <description>&lt;P&gt;The give code will drop alphabets and spaces, only contains numeric(float datatype as well)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want(drop = YourVariable);&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;NewVariable = input(compress(YourVariable,'1234567890.','k'),best12.);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 12:22:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-select-observations-containing-alphabets/m-p/540415#M149080</guid>
      <dc:creator>Sathish_jammy</dc:creator>
      <dc:date>2019-03-05T12:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: To select observations containing alphabets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-select-observations-containing-alphabets/m-p/540419#M149083</link>
      <description>&lt;P&gt;Unfortunately that doesn't match the required output (otherwise it would have been mentioned):&lt;/P&gt;
&lt;PRE&gt;data have;
  input yourvariable $;
datalines;
negative
45
1E
positive
24
;
run;


data want (drop=yourvariable);
  set have; 
  newvariable=input(compress(yourvariable,'1234567890.','k'),best12.);
run;&lt;/PRE&gt;
&lt;P&gt;See row 3.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 12:33:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-select-observations-containing-alphabets/m-p/540419#M149083</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2019-03-05T12:33:18Z</dc:date>
    </item>
  </channel>
</rss>

