<?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: format to convert numeric to character in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/format-to-convert-nueric-to-character/m-p/416880#M102373</link>
    <description>&lt;DIV class="sasSource"&gt;&lt;DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;61&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;62 data stars;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;63 input sbp dbp @@;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;64 length sbp_chk dbp_chk 4.;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;65 sbp_chk= put(sbp,3.);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;66 dbp_chk= put(dbp,3.);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;67 if sbp&amp;gt;120 then&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;68 substr(sbp_chk, 4, 1)='*';&lt;/DIV&gt;&lt;DIV class="sasError"&gt;_&lt;/DIV&gt;&lt;DIV class="sasError"&gt;356&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR: Argument to SUBSTR must be character.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE 356-185: The SUBSTR pseudo-variable function does not allow character constants, expressions, or numeric constants for the&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;first argument.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;69 if dbp&amp;gt;80 then&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;70 substr(dbp_chk, 4, 1)='*';&lt;/DIV&gt;&lt;DIV class="sasError"&gt;_&lt;/DIV&gt;&lt;DIV class="sasError"&gt;356&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR: Argument to SUBSTR must be character.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE 356-185: The SUBSTR pseudo-variable function does not allow character constants, expressions, or numeric constants for the&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;first argument.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;71 datalines;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;65:11 66:11&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;WARNING: The data set WORK.STARS may be incomplete. When this step was stopped there were 0 observations and 4 variables.&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;WARNING: Data set WORK.STARS was not replaced because this step was stopped.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.00 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.00 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;73 ;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;74 run;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;75&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;76 proc printto print='/folders/myfolders/listoutputs/f3_1stars.lst' new;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;77 run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: PROCEDURE PRINTTO used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.04 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.03 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;78&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;79 proc print ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;80 run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 3 observations read from the data set WORK.STARS.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The PROCEDURE PRINT printed page 3.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.05 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.05 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;81&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;82 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;95&lt;/DIV&gt;&lt;/DIV&gt;&lt;PRE class="sasLog"&gt;&amp;nbsp;&lt;/PRE&gt;&lt;/DIV&gt;</description>
    <pubDate>Tue, 28 Nov 2017 21:00:47 GMT</pubDate>
    <dc:creator>rk7</dc:creator>
    <dc:date>2017-11-28T21:00:47Z</dc:date>
    <item>
      <title>format to convert nueric to character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/format-to-convert-nueric-to-character/m-p/416815#M102361</link>
      <description>&lt;P&gt;Hi I have a problem converting numeric to character using put statement . It doesn't gets converted and displays error. can u pls tell me what format to use to convert numeric to character and also give the list of all formats and informants&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2017 19:16:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/format-to-convert-nueric-to-character/m-p/416815#M102361</guid>
      <dc:creator>rk7</dc:creator>
      <dc:date>2017-11-28T19:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: format to convert nueric to character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/format-to-convert-nueric-to-character/m-p/416819#M102363</link>
      <description>&lt;P&gt;If you want help with the proper syntax, you will need to show the log from what you have tried.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example of the most common error when converting from numeric to character:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;var = put(var, z5.);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The PUT function really works .... it converts the value of VAR to a character string.&amp;nbsp; However, you can't store the character string in VAR, since VAR is already defined as numeric.&amp;nbsp; The PUT function cannot change an existing variable from being numeric to being character.&amp;nbsp; Instead, you need to create a new variable:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;newvar = put(var, z5.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That may or may not be your error, but it is a very common error.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As for a list of all formats and informats ... there are hundreds of them.&amp;nbsp; You will have to search the documentation for those, although this is a decent starting point:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://documentation.sas.com/?docsetId=allprodslang&amp;amp;docsetTarget=syntaxByType-format.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;http://documentation.sas.com/?docsetId=allprodslang&amp;amp;docsetTarget=syntaxByType-format.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You won't need to know about informats, since they don't convert from numeric (only from character).&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2017 19:24:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/format-to-convert-nueric-to-character/m-p/416819#M102363</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-11-28T19:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: format to convert nueric to character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/format-to-convert-nueric-to-character/m-p/416822#M102365</link>
      <description>&lt;P&gt;In addition to what Astounding said, formats do not convert variables from numeric to character. Formats DISPLAY (not convert) numeric variables as character. Applying a format to a numeric variable means that the variable remains numeric, but may be displayed as a set of characters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;points out, the PUT statement can create a new variable with a new name which is a different type.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2017 19:28:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/format-to-convert-nueric-to-character/m-p/416822#M102365</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-11-28T19:28:46Z</dc:date>
    </item>
    <item>
      <title>Re: format to convert nueric to character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/format-to-convert-nueric-to-character/m-p/416843#M102367</link>
      <description>&lt;P&gt;can we use the converted variable as character in further statements&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2017 20:07:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/format-to-convert-nueric-to-character/m-p/416843#M102367</guid>
      <dc:creator>rk7</dc:creator>
      <dc:date>2017-11-28T20:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: format to convert numeric to character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/format-to-convert-nueric-to-character/m-p/416880#M102373</link>
      <description>&lt;DIV class="sasSource"&gt;&lt;DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;61&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;62 data stars;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;63 input sbp dbp @@;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;64 length sbp_chk dbp_chk 4.;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;65 sbp_chk= put(sbp,3.);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;66 dbp_chk= put(dbp,3.);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;67 if sbp&amp;gt;120 then&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;68 substr(sbp_chk, 4, 1)='*';&lt;/DIV&gt;&lt;DIV class="sasError"&gt;_&lt;/DIV&gt;&lt;DIV class="sasError"&gt;356&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR: Argument to SUBSTR must be character.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE 356-185: The SUBSTR pseudo-variable function does not allow character constants, expressions, or numeric constants for the&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;first argument.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;69 if dbp&amp;gt;80 then&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;70 substr(dbp_chk, 4, 1)='*';&lt;/DIV&gt;&lt;DIV class="sasError"&gt;_&lt;/DIV&gt;&lt;DIV class="sasError"&gt;356&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR: Argument to SUBSTR must be character.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE 356-185: The SUBSTR pseudo-variable function does not allow character constants, expressions, or numeric constants for the&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;first argument.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;71 datalines;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;65:11 66:11&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;WARNING: The data set WORK.STARS may be incomplete. When this step was stopped there were 0 observations and 4 variables.&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;WARNING: Data set WORK.STARS was not replaced because this step was stopped.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.00 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.00 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;73 ;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;74 run;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;75&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;76 proc printto print='/folders/myfolders/listoutputs/f3_1stars.lst' new;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;77 run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: PROCEDURE PRINTTO used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.04 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.03 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;78&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;79 proc print ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;80 run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 3 observations read from the data set WORK.STARS.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The PROCEDURE PRINT printed page 3.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.05 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.05 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;81&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;82 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;95&lt;/DIV&gt;&lt;/DIV&gt;&lt;PRE class="sasLog"&gt;&amp;nbsp;&lt;/PRE&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 28 Nov 2017 21:00:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/format-to-convert-nueric-to-character/m-p/416880#M102373</guid>
      <dc:creator>rk7</dc:creator>
      <dc:date>2017-11-28T21:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: format to convert numeric to character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/format-to-convert-nueric-to-character/m-p/416890#M102378</link>
      <description>&lt;P&gt;Your LENGTH statement is defining the new variables as numeric, when you need them to be character.&amp;nbsp; Try it this way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;length sbp_chk dbp_chk $4;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2017 21:13:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/format-to-convert-nueric-to-character/m-p/416890#M102378</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-11-28T21:13:07Z</dc:date>
    </item>
    <item>
      <title>Re: format to convert numeric to character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/format-to-convert-nueric-to-character/m-p/416892#M102380</link>
      <description>&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2017 21:14:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/format-to-convert-nueric-to-character/m-p/416892#M102380</guid>
      <dc:creator>rk7</dc:creator>
      <dc:date>2017-11-28T21:14:55Z</dc:date>
    </item>
  </channel>
</rss>

