<?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: when the character variable contains different formats then how to convert that into numeric in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/when-the-character-variable-contains-different-formats-then-how/m-p/194662#M48855</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Read the column into a char variable, then check that variable for its layout and select the proper conversion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would be nice if you could provide an example of the data in csv form, so that we can determine the actual positioning of the data in the cells.&lt;/P&gt;&lt;P&gt;(ie is "product amount" in one or 2 cells?)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Apr 2015 07:41:38 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2015-04-14T07:41:38Z</dc:date>
    <item>
      <title>when the character variable contains different formats then how to convert that into numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/when-the-character-variable-contains-different-formats-then-how/m-p/194660#M48853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin: 0 0 6px; color: #141823; font-family: helvetica, arial, 'lucida grande', sans-serif; font-size: 14px; background-color: #ffffff;"&gt;Hi all,&lt;BR /&gt;can any one know the format for this&lt;BR /&gt;i have the dataset like this&lt;/P&gt;&lt;P style="margin: 6px 0; color: #141823; font-family: helvetica, arial, 'lucida grande', sans-serif; font-size: 14px; background-color: #ffffff;"&gt;product amount&lt;SPAN class="text_exposed_show"&gt;&lt;BR /&gt;account value&lt;BR /&gt;fixed 1,52,132&lt;BR /&gt;variable 2,50,478&lt;BR /&gt;annual rate&lt;BR /&gt;product 4.5%&lt;BR /&gt;variable 5.6%&lt;BR /&gt;this over all is one dataset.&lt;BR /&gt;i have read this data from excel using libname statement.&lt;BR /&gt;and the variable amount is in character type.&lt;BR /&gt;now i have to convert the data i.e. amount into numeric.&lt;BR /&gt;can any one know the process please comment.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Apr 2015 15:46:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/when-the-character-variable-contains-different-formats-then-how/m-p/194660#M48853</guid>
      <dc:creator>Ravikumarkummari</dc:creator>
      <dc:date>2015-04-13T15:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: when the character variable contains different formats then how to convert that into numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/when-the-character-variable-contains-different-formats-then-how/m-p/194661#M48854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is all of this in one column (variable) in the SAS data set? If so this is likely to be a mess. SAS can only have one characteristic per variable, either numeric or character. So you will have to create new variables using a data step. You may need to provide a bit more data for input example AND an example of what the output should look like.&lt;/P&gt;&lt;P&gt;It looks like you actually have 3 values for the rows that start with Fixed and Variable, is that the actual case? or did we lose something in pasting into the forum?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Apr 2015 17:51:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/when-the-character-variable-contains-different-formats-then-how/m-p/194661#M48854</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-04-13T17:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: when the character variable contains different formats then how to convert that into numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/when-the-character-variable-contains-different-formats-then-how/m-p/194662#M48855</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Read the column into a char variable, then check that variable for its layout and select the proper conversion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would be nice if you could provide an example of the data in csv form, so that we can determine the actual positioning of the data in the cells.&lt;/P&gt;&lt;P&gt;(ie is "product amount" in one or 2 cells?)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2015 07:41:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/when-the-character-variable-contains-different-formats-then-how/m-p/194662#M48855</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-04-14T07:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: when the character variable contains different formats then how to convert that into numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/when-the-character-variable-contains-different-formats-then-how/m-p/194663#M48856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Am linking this thread: &lt;A _jive_internal="true" href="https://communities.sas.com/thread/75128" title="https://communities.sas.com/thread/75128"&gt;https://communities.sas.com/thread/75128&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Here, as its exactly the same question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2015 08:32:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/when-the-character-variable-contains-different-formats-then-how/m-p/194663#M48856</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-04-14T08:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: when the character variable contains different formats then how to convert that into numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/when-the-character-variable-contains-different-formats-then-how/m-p/194664#M48857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;
data have;
input p $ a : $20.;
cards;
fixed 1,52,132
variable 2,50,478
product 4.5%
variable 5.6%
;
run;
data want;
 set have;
 length fmt $ 20;
 if findc(a,',') then fmt='comma32.';
&amp;nbsp; else if findc(a,'%') then fmt='percent12.';
&amp;nbsp;&amp;nbsp; else fmt='best32.';
 v=inputn(a,fmt);
 run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2015 13:47:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/when-the-character-variable-contains-different-formats-then-how/m-p/194664#M48857</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-04-14T13:47:49Z</dc:date>
    </item>
  </channel>
</rss>

