<?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: Problem using Input to convert char with missing values to num in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Problem-using-Input-to-convert-char-with-missing-values-to-num/m-p/187203#M35444</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ok, I read some old posts und used at first the compress function to get the '.' out of the numbers and then used the first solution, and it worked well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But i am still interested in knowing, where the problem with Input comes from.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&amp;nbsp; Dingdang&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 03 Jan 2014 09:04:29 GMT</pubDate>
    <dc:creator>Dingdang</dc:creator>
    <dc:date>2014-01-03T09:04:29Z</dc:date>
    <item>
      <title>Problem using Input to convert char with missing values to num</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-using-Input-to-convert-char-with-missing-values-to-num/m-p/187202#M35443</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;first of all, wish everyone happy new year &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; I am hoping to improve my sas knowlege in 2014 and here goes the new question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to convert a char variable names 'Wert' to a num variable. It contains only natural numbers and missing values, but saved as a char as a result of a proc transpose procedure. There are a lot of suggestions in the internet how to do it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I first tried this solution:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data korr.have_num;&lt;/P&gt;&lt;P&gt;set korr.have;&lt;/P&gt;&lt;P&gt;Values=Wert*1;&lt;/P&gt;&lt;P&gt;Format Values COMMAX32.;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that I am using the num format COMMAXw. (as normally in Germany) which means period separates every three digits and a comma separates the decimal fraction. (so 30.000 doesnt equal to 30). The statement 'Format Values COMMAX32.' only specifies the format for the new variable Values but when SAS did the muplication, it still uses Commaw. format. So I got from 18.987 19, which isnt what i want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another solution war to use the input function. I tried like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;datat korr.have_num;&lt;/P&gt;&lt;P&gt;set korr.have;&lt;/P&gt;&lt;P&gt;values=input(Wert, Commax32.);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After this data step, the variable values has only missing values, which i dont understand why.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone help me solving this problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;many thanks.&amp;nbsp; Dingdang&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jan 2014 08:35:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-using-Input-to-convert-char-with-missing-values-to-num/m-p/187202#M35443</guid>
      <dc:creator>Dingdang</dc:creator>
      <dc:date>2014-01-03T08:35:57Z</dc:date>
    </item>
    <item>
      <title>Re: Problem using Input to convert char with missing values to num</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-using-Input-to-convert-char-with-missing-values-to-num/m-p/187203#M35444</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ok, I read some old posts und used at first the compress function to get the '.' out of the numbers and then used the first solution, and it worked well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But i am still interested in knowing, where the problem with Input comes from.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&amp;nbsp; Dingdang&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jan 2014 09:04:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-using-Input-to-convert-char-with-missing-values-to-num/m-p/187203#M35444</guid>
      <dc:creator>Dingdang</dc:creator>
      <dc:date>2014-01-03T09:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: Problem using Input to convert char with missing values to num</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-using-Input-to-convert-char-with-missing-values-to-num/m-p/187204#M35445</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="NL-BE" style="background: white; color: navy; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: NL-BE; mso-fareast-language: EN-GB;"&gt;data&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="NL-BE" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: NL-BE; mso-fareast-language: EN-GB;"&gt; EEN;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN lang="NL-BE" style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: NL-BE; mso-fareast-language: EN-GB;"&gt;input&lt;/SPAN&gt;&lt;SPAN lang="NL-BE" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: NL-BE; mso-fareast-language: EN-GB;"&gt; var1 $&amp;nbsp; var2:&lt;/SPAN&gt;&lt;SPAN lang="NL-BE" style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: NL-BE; mso-fareast-language: EN-GB;"&gt;$10.&lt;/SPAN&gt;&lt;SPAN lang="NL-BE" style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: NL-BE; mso-fareast-language: EN-GB;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-fareast-language: EN-GB;"&gt;datalines&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-fareast-language: EN-GB;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: #ffffc0; color: black; font-family: 'Courier New'; font-size: 10pt; mso-fareast-language: EN-GB;"&gt;100.66&amp;nbsp; 100.255,77&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-fareast-language: EN-GB;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="mso-fareast-language: EN-GB; color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-fareast-language: EN-GB;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-fareast-language: EN-GB;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="mso-fareast-language: EN-GB; color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-fareast-language: EN-GB;"&gt; TWEE;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-fareast-language: EN-GB;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-fareast-language: EN-GB;"&gt; EEN;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-fareast-language: EN-GB;"&gt; V1=input(var1,&lt;/SPAN&gt;&lt;STRONG style="mso-fareast-language: EN-GB; color: teal; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;15.&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-fareast-language: EN-GB;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-fareast-language: EN-GB;"&gt; V2=input(var2,&lt;/SPAN&gt;&lt;SPAN style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-fareast-language: EN-GB;"&gt;commax15.2&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-fareast-language: EN-GB;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt; mso-fareast-language: EN-GB;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-fareast-language: EN-GB;"&gt; V1-V2 &lt;/SPAN&gt;&lt;SPAN style="background: white; color: teal; font-family: 'Courier New'; font-size: 10pt; mso-fareast-language: EN-GB;"&gt;commax10.&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt; mso-fareast-language: EN-GB;"&gt; ; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt; &lt;STRONG style="mso-fareast-language: EN-GB; line-height: 115%; color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; line-height: 115%; font-family: 'Courier New'; font-size: 10pt; mso-fareast-language: EN-GB;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; line-height: 115%; font-family: 'Courier New'; font-size: 10pt; mso-fareast-language: EN-GB;"&gt;proc print;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; line-height: 115%; font-family: 'Courier New'; font-size: 10pt; mso-fareast-language: EN-GB;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jan 2014 13:12:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-using-Input-to-convert-char-with-missing-values-to-num/m-p/187204#M35445</guid>
      <dc:creator>Jaheuk</dc:creator>
      <dc:date>2014-01-03T13:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: Problem using Input to convert char with missing values to num</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-using-Input-to-convert-char-with-missing-values-to-num/m-p/187205#M35446</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;building upon appropriate input is typically better than the first solution as multiplying char by numeric issues a warning in the log and those should be avoided for any large process.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;could you provide a datalines example with data that does not get input properly by solution #2? Odds are you can apply some simple string function to WERT inside the input function to make it inputable appropriately. Likely strip to remove blanks or possibly the same solution you've mentionned using an alternative input format after removal of periods.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jan 2014 14:06:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-using-Input-to-convert-char-with-missing-values-to-num/m-p/187205#M35446</guid>
      <dc:creator>Vince28_Statcan</dc:creator>
      <dc:date>2014-01-03T14:06:01Z</dc:date>
    </item>
  </channel>
</rss>

