<?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: Why this code is failing? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Why-is-this-code-failing/m-p/318453#M270969</link>
    <description>&lt;P&gt;This isn't a character format, its a numeric format - applied to numbers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Remove the dollar sign from PROC FORMAT VALUE statement and the PUT function.&lt;/P&gt;</description>
    <pubDate>Tue, 13 Dec 2016 05:13:35 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-12-13T05:13:35Z</dc:date>
    <item>
      <title>Why is this code failing?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-this-code-failing/m-p/318452#M270968</link>
      <description>&lt;P&gt;I defined a format using proc format, and then try to use it in proc sql, but an error message keeps coming out and I don't know what I did wrong. Hope someone can help me with it, thanks a lot!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;17&amp;nbsp; &amp;nbsp;proc format library=Project;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;18&amp;nbsp; &amp;nbsp;value $ range&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;19&amp;nbsp; &amp;nbsp;810-high = '810+'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;20&amp;nbsp; &amp;nbsp;790-809 = '790-809'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;21&amp;nbsp; &amp;nbsp;770-789 = '770-789'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;22&amp;nbsp; &amp;nbsp;750-769 = '750-769'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;23&amp;nbsp; &amp;nbsp;730-749 = '730-749'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;24&amp;nbsp; &amp;nbsp;710-729 = '710-729'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;25&amp;nbsp; &amp;nbsp;690-709 = '690-709'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;26&amp;nbsp; &amp;nbsp;670-689 = '670-689'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;27&amp;nbsp; &amp;nbsp;650-669 = '650-669'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;28&amp;nbsp; &amp;nbsp;630-649 = '630-649'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;29&amp;nbsp; &amp;nbsp;low-629 = '&amp;lt;630'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;30&amp;nbsp; &amp;nbsp;other = 'Null or Zero';&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;31&amp;nbsp; &amp;nbsp;run;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;32&amp;nbsp; &amp;nbsp;OPTIONS FMTSEARCH=(Project);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;33&amp;nbsp; &amp;nbsp;run;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;34&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;35&amp;nbsp; &amp;nbsp;proc sql;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;36&amp;nbsp; &amp;nbsp;create table project.n1 as&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;37&amp;nbsp; &amp;nbsp;select score,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;put(Score,$range.) as range&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;38 &amp;nbsp; from&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;39 &amp;nbsp; project.student;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;40 &amp;nbsp;quit;&lt;/P&gt;
&lt;P&gt;The message is like:&lt;BR /&gt;&lt;SPAN&gt;error: character format $range in PUT function requires a character argument.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2016 08:09:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-this-code-failing/m-p/318452#M270968</guid>
      <dc:creator>xiy513</dc:creator>
      <dc:date>2016-12-13T08:09:01Z</dc:date>
    </item>
    <item>
      <title>Re: Why this code is failing?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-this-code-failing/m-p/318453#M270969</link>
      <description>&lt;P&gt;This isn't a character format, its a numeric format - applied to numbers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Remove the dollar sign from PROC FORMAT VALUE statement and the PUT function.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2016 05:13:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-this-code-failing/m-p/318453#M270969</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-13T05:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: Why this code is failing?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-this-code-failing/m-p/318455#M270970</link>
      <description>&lt;P&gt;Thanks for replying, I did what you said but it returned another message like&amp;nbsp;ERROR: The format $RANGE was not found or could not be loaded. I did remove the dollar sign from value statement.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2016 05:24:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-this-code-failing/m-p/318455#M270970</guid>
      <dc:creator>xiy513</dc:creator>
      <dc:date>2016-12-13T05:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: Why this code is failing?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-this-code-failing/m-p/318461#M270971</link>
      <description>&lt;P&gt;Post your code and log.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2016 06:11:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-this-code-failing/m-p/318461#M270971</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-13T06:11:18Z</dc:date>
    </item>
    <item>
      <title>Re: Why this code is failing?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-this-code-failing/m-p/318469#M270972</link>
      <description>&lt;P&gt;It worked after all, thanks. But the problem is the format 'range' has to be a character format according to the requirement, so I wonder if there is a way to do it?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2016 06:55:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-this-code-failing/m-p/318469#M270972</guid>
      <dc:creator>xiy513</dc:creator>
      <dc:date>2016-12-13T06:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: Why this code is failing?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-this-code-failing/m-p/318472#M270973</link>
      <description>&lt;P&gt;In your sql code you used the format in &lt;STRONG&gt;"put(Score,$range.) as range"&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;What type is the score variable&lt;/STRONG&gt; ? If sas asks for $format it means that the variable is a alphanumeric,&lt;/P&gt;
&lt;P&gt;then use: &lt;STRONG&gt;&amp;nbsp;put(input(score, best 5.),range.)&lt;/STRONG&gt; as range and &lt;STRONG&gt;remove the $&lt;/STRONG&gt; from the value statment .&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2016 07:16:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-this-code-failing/m-p/318472#M270973</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2016-12-13T07:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: Why is this code failing?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-this-code-failing/m-p/318486#M270974</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/119404"&gt;@xiy513&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;It worked after all, thanks. But the problem is the format 'range' has to be a character format according to the requirement, so I wonder if there is a way to do it?&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The result of the put() function is always of type character.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To really illustrate your issue, you need to supply example data; &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;do so in a data step&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2016 08:09:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-this-code-failing/m-p/318486#M270974</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-12-13T08:09:24Z</dc:date>
    </item>
  </channel>
</rss>

