<?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: SCAN and STR Function in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/SCAN-and-STR-Function/m-p/899670#M11142</link>
    <description>Use INPUT to convert a character variable to numeric, not sure what is the purpose of SUBSTR. &lt;BR /&gt;&lt;BR /&gt;lowerCI = input(scan(countyCI, 2, ':-'),  best12.);&lt;BR /&gt;&lt;BR /&gt;Note that I would recommend running the scan function first to verify what it's returning for your text and then try the conversion. &lt;BR /&gt;</description>
    <pubDate>Mon, 23 Oct 2023 19:08:01 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2023-10-23T19:08:01Z</dc:date>
    <item>
      <title>SCAN and STR Function</title>
      <link>https://communities.sas.com/t5/SAS-Studio/SCAN-and-STR-Function/m-p/899667#M11140</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to extract the lower bounds of a 95% CI from a character string and I am trying to extract the number while making it numeric.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The character string I am extracting from is "&lt;SPAN&gt;95% C.I.: 7.7 - 10.7" I am trying to just keep the 7.7 and make it numeric.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The code I put in is:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;DATA WORK.CI;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SET OLD DATA;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;countylowerCI = SUBSTR(SCAN(countyCI, 1, ':-'));&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RUN;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;What am I doing wrong?&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 23 Oct 2023 19:00:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/SCAN-and-STR-Function/m-p/899667#M11140</guid>
      <dc:creator>kcvaldez98</dc:creator>
      <dc:date>2023-10-23T19:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: SCAN and SUBSTR Function</title>
      <link>https://communities.sas.com/t5/SAS-Studio/SCAN-and-STR-Function/m-p/899669#M11141</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/456544"&gt;@kcvaldez98&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;countylowerCI = SUBSTR(SCAN(countyCI, 1, ':-'));&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does this help you figure it out?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
    countyci="95% C.I.: 7.7 - 10.7";
    word1=scan(countyCI, 1, ':-');
    word2=scan(countyCI, 2, ':-');
    word3=scan(countyCI, 3, ':-');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The above code does not return a numeric value, it returns a character string, but I'm guessing you make that change after you figure it out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why are you getting confidence intervals as text strings? All SAS procedures can get the actual numerical value as output, that's a much better way to go.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2023 19:10:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/SCAN-and-STR-Function/m-p/899669#M11141</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-10-23T19:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: SCAN and STR Function</title>
      <link>https://communities.sas.com/t5/SAS-Studio/SCAN-and-STR-Function/m-p/899670#M11142</link>
      <description>Use INPUT to convert a character variable to numeric, not sure what is the purpose of SUBSTR. &lt;BR /&gt;&lt;BR /&gt;lowerCI = input(scan(countyCI, 2, ':-'),  best12.);&lt;BR /&gt;&lt;BR /&gt;Note that I would recommend running the scan function first to verify what it's returning for your text and then try the conversion. &lt;BR /&gt;</description>
      <pubDate>Mon, 23 Oct 2023 19:08:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/SCAN-and-STR-Function/m-p/899670#M11142</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-10-23T19:08:01Z</dc:date>
    </item>
    <item>
      <title>Re: SCAN and STR Function</title>
      <link>https://communities.sas.com/t5/SAS-Studio/SCAN-and-STR-Function/m-p/899671#M11143</link>
      <description>&lt;P&gt;As suggested, do this in stages. First scan the character string, confirming you have the right number (as a character string), then convert it using the INPUT function.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;DATA CI;
	countyCI = "95% C.I.: 7.7 - 10.7";
	countylowerCI_char = SCAN(countyCI, 2, ':-');
	countylowerCI_num  = input(countylowerCI_char,best10.);
RUN;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Oct 2023 19:12:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/SCAN-and-STR-Function/m-p/899671#M11143</guid>
      <dc:creator>antonbcristina</dc:creator>
      <dc:date>2023-10-23T19:12:38Z</dc:date>
    </item>
  </channel>
</rss>

