<?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 Data Extraction in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Data-Extraction/m-p/740591#M231378</link>
    <description>&lt;P&gt;I have a variable which contains values like below:&lt;/P&gt;
&lt;PRE class="aLF-aPX-K0-aPE"&gt;4.9 x 10(6)/kg
2.51 x 10(6)/kg
7.54 x 10(6) / kg
1.90 x 10(6)/kg
2.23 x 10(6)/kg
2.29 x 10^6
2.51 x 10(6)/kg
2.55 x 10(6)/kg
2.58 x 10(6)/kg
2.96 x 10(6)/kg
2.98 x 10(6)/kg
3.06 x 10^(6) cells/kg
3.14 x 10(6)/kg
3.96 x 10 (6)
4.38 x 10(6)/kg
4.60 x 10(6)/kg
4.9 x 10(6)/kg
5.12 x 10^(6) cells/kg
5.13 x 10(6)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;I want the only numeric data like&lt;/P&gt;
&lt;P&gt;4.9&lt;/P&gt;
&lt;P&gt;2.51&lt;/P&gt;
&lt;P&gt;7.54&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;I tried using scan, count, countw, find, index. But sas is unable to capture the (x,*, blank). Any inputs appreciated.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 11 May 2021 19:29:59 GMT</pubDate>
    <dc:creator>RAVI2000</dc:creator>
    <dc:date>2021-05-11T19:29:59Z</dc:date>
    <item>
      <title>Data Extraction</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Extraction/m-p/740591#M231378</link>
      <description>&lt;P&gt;I have a variable which contains values like below:&lt;/P&gt;
&lt;PRE class="aLF-aPX-K0-aPE"&gt;4.9 x 10(6)/kg
2.51 x 10(6)/kg
7.54 x 10(6) / kg
1.90 x 10(6)/kg
2.23 x 10(6)/kg
2.29 x 10^6
2.51 x 10(6)/kg
2.55 x 10(6)/kg
2.58 x 10(6)/kg
2.96 x 10(6)/kg
2.98 x 10(6)/kg
3.06 x 10^(6) cells/kg
3.14 x 10(6)/kg
3.96 x 10 (6)
4.38 x 10(6)/kg
4.60 x 10(6)/kg
4.9 x 10(6)/kg
5.12 x 10^(6) cells/kg
5.13 x 10(6)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;I want the only numeric data like&lt;/P&gt;
&lt;P&gt;4.9&lt;/P&gt;
&lt;P&gt;2.51&lt;/P&gt;
&lt;P&gt;7.54&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;I tried using scan, count, countw, find, index. But sas is unable to capture the (x,*, blank). Any inputs appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 May 2021 19:29:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Extraction/m-p/740591#M231378</guid>
      <dc:creator>RAVI2000</dc:creator>
      <dc:date>2021-05-11T19:29:59Z</dc:date>
    </item>
    <item>
      <title>Re: Data Extraction</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Extraction/m-p/740601#M231385</link>
      <description>From your shown data SCAN() would work, so I suspect not all your data is as shown then? Can you elaborate on how SCAN() does not work?&lt;BR /&gt;&lt;BR /&gt;Your statement: But sas is unable to capture the (x,*, blank). &lt;BR /&gt;Your output data however shows none of that information, so what exactly do you want?&lt;BR /&gt;&lt;BR /&gt;I would assume one of these would work:&lt;BR /&gt;&lt;BR /&gt;x = scan(variable, 1);&lt;BR /&gt;y = scan(variable, 1, "/");&lt;BR /&gt;</description>
      <pubDate>Tue, 11 May 2021 20:05:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Extraction/m-p/740601#M231385</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-05-11T20:05:22Z</dc:date>
    </item>
    <item>
      <title>Re: Data Extraction</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Extraction/m-p/740602#M231386</link>
      <description>&lt;P&gt;Is this what you're looking for?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
    input string $32.;
    datalines;
4.9 x 10(6)/kg
2.51 x 10(6)/kg
7.54 x 10(6) / kg
1.90 x 10(6)/kg
2.23 x 10(6)/kg
2.29 x 10^6
2.51 x 10(6)/kg
2.55 x 10(6)/kg
2.58 x 10(6)/kg
2.96 x 10(6)/kg
2.98 x 10(6)/kg
3.06 x 10^(6) cells/kg
3.14 x 10(6)/kg
3.96 x 10 (6)
4.38 x 10(6)/kg
4.60 x 10(6)/kg
4.9 x 10(6)/kg
5.12 x 10^(6) cells/kg
5.13 x 10(6)
;
run;

data want;
    set have;
    number = input(substr(string, 1, find(string, 'x', 1)-1), best.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 May 2021 20:08:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Extraction/m-p/740602#M231386</guid>
      <dc:creator>mklangley</dc:creator>
      <dc:date>2021-05-11T20:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: Data Extraction</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Extraction/m-p/740623#M231401</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;From your shown data SCAN() would work, so I suspect not all your data is as shown then? Can you elaborate on how SCAN() does not work?&lt;BR /&gt;&lt;BR /&gt;Your statement: But sas is unable to capture the (x,*, blank). &lt;BR /&gt;Your output data however shows none of that information, so what exactly do you want?&lt;BR /&gt;&lt;BR /&gt;I would assume one of these would work:&lt;BR /&gt;&lt;BR /&gt;x = scan(variable, 1);&lt;BR /&gt;y = scan(variable, 1, "/");&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Because the decimal is a default delimiter in SCAN I think to get the "number" part you want&lt;/P&gt;
&lt;P&gt;x = scan(variable, 1,' '); to force just getting the first bit of numbers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And to get a numeric value:&lt;/P&gt;
&lt;P&gt;x = input (scan(variable,1,' '),f8.);&lt;/P&gt;</description>
      <pubDate>Tue, 11 May 2021 21:17:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Extraction/m-p/740623#M231401</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-05-11T21:17:42Z</dc:date>
    </item>
  </channel>
</rss>

