<?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: About convert variable's type in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/About-convert-variable-s-type/m-p/156258#M30538</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks! It's my fault, not the quotation marks' problem. The data contain a RETURN Key, that's the key.&lt;/P&gt;&lt;P&gt;I just didn't find out, when I use notepad++ open the exported data, it looks like this, different from the notepad.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="QQ截图20140513132742.png" class="jive-image-thumbnail jive-image" src="https://communities.sas.com/legacyfs/online/6301_QQ截图20140513132742.png" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I use $hex. format to put the data, and there is a RETURN key, check out my another comment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you all the same!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 May 2014 05:29:42 GMT</pubDate>
    <dc:creator>Slash</dc:creator>
    <dc:date>2014-05-13T05:29:42Z</dc:date>
    <item>
      <title>About convert variable's type</title>
      <link>https://communities.sas.com/t5/SAS-Programming/About-convert-variable-s-type/m-p/156254#M30534</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;H5&gt;&lt;SPAN style="color: #000000;"&gt;Hi, guys!&lt;/SPAN&gt;&lt;/H5&gt;&lt;H5&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/H5&gt;&lt;H5&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I got a problem, find the reason, but do not know how to fix it. Here it is:&lt;/SPAN&gt;&lt;/H5&gt;&lt;H5&gt;&lt;SPAN style="color: #000000;"&gt;The sas data is read by using IMPORT procedure. Here is the data look like:&lt;/SPAN&gt;&lt;/H5&gt;&lt;P&gt;&lt;IMG __jive_id="6294" alt="QQ截图20140513104222.png" class="jive-image-thumbnail jive-image" src="https://communities.sas.com/legacyfs/online/6294_QQ截图20140513104222.png" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;Notice that the last variable GPRS_FLUX is character. So I want to convert it to numeric. I use these code:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;
&lt;P&gt;data work.test;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; set data.sas_info_20140512173730(rename=(gprs_flux=tp_0));&lt;/P&gt;
&lt;P&gt;&amp;nbsp; gprs_flux=input(tp_0,best12.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; drop tp_:;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;Unfortunately, the log told me that &lt;SPAN style="color: #ff0000;"&gt;the convertion is failed!!!&lt;/SPAN&gt; Here is the Log:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="6295" alt="QQ图片20140513105137.jpg" class="jive-image-thumbnail jive-image" src="https://communities.sas.com/legacyfs/online/6295_QQ图片20140513105137.jpg" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;It said&lt;/SPAN&gt;&lt;SPAN style="color: #ff0000;"&gt; &lt;STRONG&gt;the argument of the INPUT function is invalid at row 20, col 12&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;SPAN style="color: #000000;"&gt; I really cannot find which is invalid. It t&lt;SPAN class="ordinary-span-edit high-light-bg"&gt;ortured me half an hour.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="ordinary-span-edit high-light-bg" style="color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="ordinary-span-edit high-light-bg" style="color: #000000;"&gt;Finally I export the data to TXT file, I realize the problem. Here is the exported text file:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="ordinary-span-edit high-light-bg"&gt;&lt;IMG __jive_id="6296" alt="QQ图片20140513110258.jpg" class="jive-image-thumbnail jive-image" src="https://communities.sas.com/legacyfs/online/6296_QQ图片20140513110258.jpg" width="450" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #575757;"&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;It got a quotation marks!&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #000000;"&gt;How does this happen???? Why I can't see it in EG???? &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;So the problem is caused by the quotation marks, so how to convert it to numeric?&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #003366;"&gt;Note: the data is in the remote SAS server,&amp;nbsp; so don't tell me to read the data again. Because there are lots of data is automatically read, and the data's column is not same at each time, so must use the IMPORT procedure.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2014 03:12:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/About-convert-variable-s-type/m-p/156254#M30534</guid>
      <dc:creator>Slash</dc:creator>
      <dc:date>2014-05-13T03:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: About convert variable's type</title>
      <link>https://communities.sas.com/t5/SAS-Programming/About-convert-variable-s-type/m-p/156255#M30535</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure about the data type when you imported but you can use &lt;STRONG&gt;dequote &lt;/STRONG&gt;to get rid of quotation marks. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data work.test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set data.sas_info_20140512173730(rename=(gprs_flux=tp_0)); &lt;/P&gt;&lt;P&gt;&amp;nbsp; gprs_flux=input(&lt;STRONG&gt;dequote&lt;/STRONG&gt;(tp_0),best12.);&lt;/P&gt;&lt;P&gt;&amp;nbsp; drop tp_:;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2014 03:41:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/About-convert-variable-s-type/m-p/156255#M30535</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-05-13T03:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: About convert variable's type</title>
      <link>https://communities.sas.com/t5/SAS-Programming/About-convert-variable-s-type/m-p/156256#M30536</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please try the below code&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data work.test;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;set data.sas_info_20140512173730(rename=(gprs_flux=tp_0));&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;gprs_flux=input(compress(tp_0,,'kw'),best12.);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;drop tp_:;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used the compress function to remove the non printable characters. There are some hidden non printable characters in the variable imported. Due to which the character data is not converted to numeric.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: KW in compress stands for keep writable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&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>Tue, 13 May 2014 05:00:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/About-convert-variable-s-type/m-p/156256#M30536</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2014-05-13T05:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: About convert variable's type</title>
      <link>https://communities.sas.com/t5/SAS-Programming/About-convert-variable-s-type/m-p/156257#M30537</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Thanks very much! That can fix this problem.&lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://communities.sas.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; And I learn the another usage of compress function. Thanks again!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;And I also find the character which cause the problem, it's not the quotation marks. It's the RETURN key.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I use $hex. format to put the variable's value, find the '0d'x character. Here it is:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set data.bqc_to_sas_info_20140512173730(obs=10);&lt;/P&gt;&lt;P&gt;&amp;nbsp; tp=put(gprs_flux,$hex.);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="QQ截图20140513131738.png" class="jive-image" src="https://communities.sas.com/legacyfs/online/6300_QQ截图20140513131738.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2014 05:22:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/About-convert-variable-s-type/m-p/156257#M30537</guid>
      <dc:creator>Slash</dc:creator>
      <dc:date>2014-05-13T05:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: About convert variable's type</title>
      <link>https://communities.sas.com/t5/SAS-Programming/About-convert-variable-s-type/m-p/156258#M30538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks! It's my fault, not the quotation marks' problem. The data contain a RETURN Key, that's the key.&lt;/P&gt;&lt;P&gt;I just didn't find out, when I use notepad++ open the exported data, it looks like this, different from the notepad.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="QQ截图20140513132742.png" class="jive-image-thumbnail jive-image" src="https://communities.sas.com/legacyfs/online/6301_QQ截图20140513132742.png" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I use $hex. format to put the data, and there is a RETURN key, check out my another comment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you all the same!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2014 05:29:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/About-convert-variable-s-type/m-p/156258#M30538</guid>
      <dc:creator>Slash</dc:creator>
      <dc:date>2014-05-13T05:29:42Z</dc:date>
    </item>
  </channel>
</rss>

