<?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 converter numeric variable to character bigger than 30 in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/converter-numeric-variable-to-character-bigger-than-30/m-p/94960#M26858</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all, in order to convert a numeric variable to character WITH LENGTH=30 I use the function PUT:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VARC=PUT(VARN,30.);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but my problem appears when I try to convert a variable with length=40, or bigger:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VARC=PUT(VARN,50.);...it gives me an error of width&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any help?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;V.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 Jun 2013 14:47:46 GMT</pubDate>
    <dc:creator>michtka</dc:creator>
    <dc:date>2013-06-04T14:47:46Z</dc:date>
    <item>
      <title>converter numeric variable to character bigger than 30</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/converter-numeric-variable-to-character-bigger-than-30/m-p/94960#M26858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all, in order to convert a numeric variable to character WITH LENGTH=30 I use the function PUT:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VARC=PUT(VARN,30.);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but my problem appears when I try to convert a variable with length=40, or bigger:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VARC=PUT(VARN,50.);...it gives me an error of width&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any help?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;V.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jun 2013 14:47:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/converter-numeric-variable-to-character-bigger-than-30/m-p/94960#M26858</guid>
      <dc:creator>michtka</dc:creator>
      <dc:date>2013-06-04T14:47:46Z</dc:date>
    </item>
    <item>
      <title>Re: converter numeric variable to character bigger than 30</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/converter-numeric-variable-to-character-bigger-than-30/m-p/94961#M26859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have to realize that your data values are probably incorrect.&amp;nbsp; SAS does not accurately store numbers beyond 15 or 16 significant digits.&amp;nbsp; Here is a program you can run to illustrate:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;x=12345678901234567890;&lt;/P&gt;&lt;P&gt;put x 20.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With that in mind, is your original question something that you need to solve or do you need to rethink an earlier part of the process?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jun 2013 15:01:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/converter-numeric-variable-to-character-bigger-than-30/m-p/94961#M26859</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2013-06-04T15:01:53Z</dc:date>
    </item>
    <item>
      <title>Re: converter numeric variable to character bigger than 30</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/converter-numeric-variable-to-character-bigger-than-30/m-p/94962#M26860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;***It is fine;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data new;&lt;BR /&gt;varn=3;&lt;BR /&gt;varc=compress(put(varn,30.));&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;***It is not;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data new2;&lt;BR /&gt;varn=3;&lt;BR /&gt;varc=compress(put(varn,40.));&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;ERROR 29-185: Width specified for format F is invalid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Q is....How can obtain varc with LENGHT = 40 or superior.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it is more clear now, Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jun 2013 15:09:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/converter-numeric-variable-to-character-bigger-than-30/m-p/94962#M26860</guid>
      <dc:creator>michtka</dc:creator>
      <dc:date>2013-06-04T15:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: converter numeric variable to character bigger than 30</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/converter-numeric-variable-to-character-bigger-than-30/m-p/94963#M26861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, this won't solve the problem if it turns out that your data values are already incorrect.&amp;nbsp; But it will convert them:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;length varc $ 50;&lt;/P&gt;&lt;P&gt;varc = varn;&lt;/P&gt;&lt;P&gt;varc = left(varc);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can always omit the LEFT function if you prefer.&amp;nbsp; But don't combine into one statement.&amp;nbsp; You'll get scientific notation if you try:&amp;nbsp; varc = left(varn);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jun 2013 15:19:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/converter-numeric-variable-to-character-bigger-than-30/m-p/94963#M26861</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2013-06-04T15:19:49Z</dc:date>
    </item>
    <item>
      <title>Re: converter numeric variable to character bigger than 30</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/converter-numeric-variable-to-character-bigger-than-30/m-p/94964#M26862</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for that, but still not convince with your answer, sorry, my Q is , why can't do it with the PUT function, this my question &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;. Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jun 2013 15:26:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/converter-numeric-variable-to-character-bigger-than-30/m-p/94964#M26862</guid>
      <dc:creator>michtka</dc:creator>
      <dc:date>2013-06-04T15:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: converter numeric variable to character bigger than 30</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/converter-numeric-variable-to-character-bigger-than-30/m-p/94965#M26863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is like I want to achieve, as you can see, I need the length superior to 30, because the lenght need to match to add this extraline with PROC APPEND &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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data new;&lt;BR /&gt;varn=3;&lt;BR /&gt;varc=compress(put(varn,30.));&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data new2;&lt;BR /&gt;varn=3;&lt;BR /&gt;varc=compress(put(varn,40.));&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data extra; length varc $30.;retain varc "Numbers of subjects living in the island of the Pacific Ocean" varn 0 ;run;&amp;nbsp; /* 30 is not enoguh */&lt;BR /&gt;proc append base=new data=extra;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jun 2013 15:38:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/converter-numeric-variable-to-character-bigger-than-30/m-p/94965#M26863</guid>
      <dc:creator>michtka</dc:creator>
      <dc:date>2013-06-04T15:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: converter numeric variable to character bigger than 30</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/converter-numeric-variable-to-character-bigger-than-30/m-p/94966#M26864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, this would work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;length varc $ 50;&lt;/P&gt;&lt;P&gt;varc = right(put(varn, 15.));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the answer is that's the way SAS built the w.d format.&amp;nbsp; Maximum width is 32, per the documentation:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/leforinforref/63324/HTML/default/viewer.htm#n1n7bmvs1brl23n1dj9cbzau39df.htm"&gt;http://support.sas.com/documentation/cdl/en/leforinforref/63324/HTML/default/viewer.htm#n1n7bmvs1brl23n1dj9cbzau39df.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jun 2013 15:55:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/converter-numeric-variable-to-character-bigger-than-30/m-p/94966#M26864</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2013-06-04T15:55:56Z</dc:date>
    </item>
    <item>
      <title>Re: converter numeric variable to character bigger than 30</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/converter-numeric-variable-to-character-bigger-than-30/m-p/94967#M26865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks &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;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jun 2013 16:12:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/converter-numeric-variable-to-character-bigger-than-30/m-p/94967#M26865</guid>
      <dc:creator>michtka</dc:creator>
      <dc:date>2013-06-04T16:12:14Z</dc:date>
    </item>
  </channel>
</rss>

