<?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: help : read numeric variables in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/help-read-numeric-variables/m-p/73239#M21234</link>
    <description>seeking a suitable informat is a popular forum question.&lt;BR /&gt;
Although there is an informat for percentages (PERCENT.) I was not sure about a trailing M.&lt;BR /&gt;
Previously I have responded &lt;A href="http://support.sas.com/forums/thread.jspa?messageID=40725#40725" target="_blank"&gt;http://support.sas.com/forums/thread.jspa?messageID=40725#40725&lt;/A&gt; pointing out a technique to get SAS to try all available informats&lt;BR /&gt;
Checking the technique with string 1000M, the best result came from informat SIZEKMG. You might not want the result from this informat &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; as it assumes the M implies megabytes because the result I got was 1048576000.&lt;BR /&gt;
I see no alternative other than reading that input column as a string and parsing as needed .&lt;BR /&gt;
 &lt;BR /&gt;
good luck&lt;BR /&gt;
peterC</description>
    <pubDate>Mon, 20 Sep 2010 11:23:25 GMT</pubDate>
    <dc:creator>Peter_C</dc:creator>
    <dc:date>2010-09-20T11:23:25Z</dc:date>
    <item>
      <title>help : read numeric variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/help-read-numeric-variables/m-p/73238#M21233</link>
      <description>hi , i got a question  in the follow program.  how could i get the reading of variables ''ssm &amp;amp;  sspm'':  eg, ssm 5.04M as numeric as 5million and 40 thousand,  and eg, sspm 0.625% as numeric as 0.625 percentage.&lt;BR /&gt;
-------------------------------------------------------------&lt;BR /&gt;
data projects;                                                                  &lt;BR /&gt;
  input  stdate : ddmmyy10. ssv : comma10. ssm   idm sspm idssm sspidssm  ;                        &lt;BR /&gt;
  format stdate ddmmyy10.  ssv : comma10. ssm  idm sspm idssm sspidssm ;                                            &lt;BR /&gt;
datalines;   &lt;BR /&gt;
10/09/2010 588,000 5.04M 807.192M 0.625% 3.567B 0.141% &lt;BR /&gt;
09/09/2010 2,166,000 18.506M 568.513M 3.255% 4.494B 0.412% &lt;BR /&gt;
08/09/2010 1,512,000 12.805M 548.069M 2.336% 4.094B 0.313% &lt;BR /&gt;
;     &lt;BR /&gt;
 &lt;BR /&gt;
proc print data=projects;                                                &lt;BR /&gt;
run;</description>
      <pubDate>Mon, 20 Sep 2010 07:57:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/help-read-numeric-variables/m-p/73238#M21233</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-09-20T07:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: help : read numeric variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/help-read-numeric-variables/m-p/73239#M21234</link>
      <description>seeking a suitable informat is a popular forum question.&lt;BR /&gt;
Although there is an informat for percentages (PERCENT.) I was not sure about a trailing M.&lt;BR /&gt;
Previously I have responded &lt;A href="http://support.sas.com/forums/thread.jspa?messageID=40725#40725" target="_blank"&gt;http://support.sas.com/forums/thread.jspa?messageID=40725#40725&lt;/A&gt; pointing out a technique to get SAS to try all available informats&lt;BR /&gt;
Checking the technique with string 1000M, the best result came from informat SIZEKMG. You might not want the result from this informat &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; as it assumes the M implies megabytes because the result I got was 1048576000.&lt;BR /&gt;
I see no alternative other than reading that input column as a string and parsing as needed .&lt;BR /&gt;
 &lt;BR /&gt;
good luck&lt;BR /&gt;
peterC</description>
      <pubDate>Mon, 20 Sep 2010 11:23:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/help-read-numeric-variables/m-p/73239#M21234</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-09-20T11:23:25Z</dc:date>
    </item>
    <item>
      <title>Re: help : read numeric variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/help-read-numeric-variables/m-p/73240#M21235</link>
      <description>In case you want help with that parsing business, you could do something like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
data projects;&lt;BR /&gt;
    input stdate : ddmmyy10. ssv : comma10. chssm : $20. idm chsspm : $20. idssm sspidssm ;&lt;BR /&gt;
    ssm = input( substr( chssm, 1, index( chssm, 'M' ) -1 ), 5. ) * 1000000;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Nested function calls are not always easy to read so we could break it down for readability like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
    pos = index( chssm, 'M' ); *this finds the 'M' in '5.04M';&lt;BR /&gt;
    chnbr = substr( chssm, 1, pos -1 );  *extract the numeric characters without the 'M';&lt;BR /&gt;
    ssm = input( chnbr, 5. ) * 1000000;  *read the character numbers as a number and multiply by 1000000;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
The approach to obtaining sspm would be similar.</description>
      <pubDate>Tue, 21 Sep 2010 01:11:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/help-read-numeric-variables/m-p/73240#M21235</guid>
      <dc:creator>WaltSmith</dc:creator>
      <dc:date>2010-09-21T01:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: help : read numeric variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/help-read-numeric-variables/m-p/73241#M21236</link>
      <description>thanks waltsmith, there a lot of beautiful people live around.  god bless</description>
      <pubDate>Tue, 21 Sep 2010 03:45:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/help-read-numeric-variables/m-p/73241#M21236</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-09-21T03:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: help : read numeric variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/help-read-numeric-variables/m-p/73242#M21237</link>
      <description>thanks peter c. keep the good things inside u</description>
      <pubDate>Tue, 21 Sep 2010 04:16:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/help-read-numeric-variables/m-p/73242#M21237</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-09-21T04:16:59Z</dc:date>
    </item>
  </channel>
</rss>

