<?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: Retrieve Value from a string in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Retrieve-Value-from-a-string/m-p/169119#M43738</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also if you want to know the different nth values, try the below code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; string="X!3.479!3.49902!3.43968!3.49919!3.5432!3.69513!3.52109!3.53714!";&lt;/P&gt;&lt;P&gt;do i = 1 to 10;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; new=scan(string,i,'!');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jag&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 10 Feb 2014 14:46:42 GMT</pubDate>
    <dc:creator>Jagadishkatam</dc:creator>
    <dc:date>2014-02-10T14:46:42Z</dc:date>
    <item>
      <title>Retrieve Value from a string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Retrieve-Value-from-a-string/m-p/169115#M43734</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need help with the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a 2 variables in a dataset&lt;/P&gt;&lt;P&gt;n= number&lt;/P&gt;&lt;P&gt;label = string e.g. &lt;SPAN style="font-family: 'Calibri','sans-serif'; font-size: 11pt;"&gt;X!3.479!3.49902!3.43968!3.49919!3.5432!3.69513!3.52109!3.53714!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Calibri','sans-serif'; font-size: 11pt;"&gt;What I need to do is - retrieve the 'n' th value (seperated by "!").&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Calibri','sans-serif'; font-size: 11pt;"&gt;For example:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Calibri','sans-serif'; font-size: 11pt;"&gt;n= 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Calibri','sans-serif'; font-size: 11pt;"&gt;value= 3.49902&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Calibri','sans-serif'; font-size: 11pt;"&gt;Im guessing I need to use a scan?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Calibri','sans-serif'; font-size: 11pt;"&gt;Many thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Feb 2014 14:18:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Retrieve-Value-from-a-string/m-p/169115#M43734</guid>
      <dc:creator>jammy</dc:creator>
      <dc:date>2014-02-10T14:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve Value from a string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Retrieve-Value-from-a-string/m-p/169116#M43735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Feb 2014 14:31:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Retrieve-Value-from-a-string/m-p/169116#M43735</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2014-02-10T14:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve Value from a string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Retrieve-Value-from-a-string/m-p/169117#M43736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;jammy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, you'll need SCAN.&amp;nbsp; However, SCAN alone will create VALUE as a character variable:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;value = scan(string, n, '!');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want VALUE as a numeric variable, you'll have to apply the INPUT function to the result returned by the SCAN function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;value = input( scan(string, n, '!'), 8.);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It won't hurt to use a length of 8 in the INPUT function when the incoming string contains fewer than 8 characters.&amp;nbsp; Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Feb 2014 14:36:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Retrieve-Value-from-a-string/m-p/169117#M43736</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2014-02-10T14:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve Value from a string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Retrieve-Value-from-a-string/m-p/169118#M43737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;My bad..... I was trying to make it more complicated than it is!&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Feb 2014 14:37:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Retrieve-Value-from-a-string/m-p/169118#M43737</guid>
      <dc:creator>jammy</dc:creator>
      <dc:date>2014-02-10T14:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve Value from a string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Retrieve-Value-from-a-string/m-p/169119#M43738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also if you want to know the different nth values, try the below code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; string="X!3.479!3.49902!3.43968!3.49919!3.5432!3.69513!3.52109!3.53714!";&lt;/P&gt;&lt;P&gt;do i = 1 to 10;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; new=scan(string,i,'!');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jag&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Feb 2014 14:46:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Retrieve-Value-from-a-string/m-p/169119#M43738</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2014-02-10T14:46:42Z</dc:date>
    </item>
  </channel>
</rss>

