<?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 Convert variable to character in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Convert-variable-to-character/m-p/438151#M69050</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I want to convert a already read in variable into a character - the opposite of e.g &lt;EM&gt;new_breed=breed*1&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I am thankful for any help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 17 Feb 2018 12:25:22 GMT</pubDate>
    <dc:creator>LauraFranziska</dc:creator>
    <dc:date>2018-02-17T12:25:22Z</dc:date>
    <item>
      <title>Convert variable to character</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Convert-variable-to-character/m-p/438151#M69050</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I want to convert a already read in variable into a character - the opposite of e.g &lt;EM&gt;new_breed=breed*1&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I am thankful for any help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Feb 2018 12:25:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Convert-variable-to-character/m-p/438151#M69050</guid>
      <dc:creator>LauraFranziska</dc:creator>
      <dc:date>2018-02-17T12:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: Convert variable to character</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Convert-variable-to-character/m-p/438153#M69051</link>
      <description>&lt;P&gt;You cannot convert a numeric variable to character.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can make a new character variable from a numeric variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;char_var = put ( num_var, 5.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or use whatever format works in your case&lt;/P&gt;</description>
      <pubDate>Sat, 17 Feb 2018 12:28:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Convert-variable-to-character/m-p/438153#M69051</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-02-17T12:28:49Z</dc:date>
    </item>
    <item>
      <title>Re: Convert variable to character</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Convert-variable-to-character/m-p/438155#M69052</link>
      <description>&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;What is the 5 for?&lt;/P&gt;&lt;P&gt;Sorry, I'm new to SAS... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Feb 2018 13:02:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Convert-variable-to-character/m-p/438155#M69052</guid>
      <dc:creator>LauraFranziska</dc:creator>
      <dc:date>2018-02-17T13:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: Convert variable to character</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Convert-variable-to-character/m-p/438158#M69053</link>
      <description>&lt;P&gt;Hi:&lt;BR /&gt; The 5. is a FORMAT -- it is the format that SAS uses to make the conversion. So, for example, if you have this &lt;FONT face="courier new,courier"&gt;zip=123&lt;/FONT&gt; and you want to make &lt;FONT face="courier new,courier"&gt;charzip = 00123&lt;/FONT&gt; as a character variable then you would use the z5. format, like this:&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;charzip = put(zip,z5.);&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;Or, if you have this: &lt;FONT face="courier new,courier"&gt;area=303&lt;/FONT&gt; and you want this: &lt;FONT face="courier new,courier"&gt;char_area (303)&lt;/FONT&gt;, then you would do:&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;char_area=catt('(',put(area,3.),')');&lt;/STRONG&gt; &lt;/FONT&gt;(concatenate the ( and ) with the character string 303 after the PUT function.&lt;BR /&gt;&lt;BR /&gt;We teach about the PUT and INPUT functions and variable conversions in the Programming 2 class.&lt;BR /&gt;&lt;BR /&gt;cynthia&lt;/P&gt;</description>
      <pubDate>Sat, 17 Feb 2018 14:40:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Convert-variable-to-character/m-p/438158#M69053</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-02-17T14:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: Convert variable to character</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Convert-variable-to-character/m-p/438348#M69087</link>
      <description>&lt;P&gt;&lt;EM&gt;new_breed=breed*1&lt;/EM&gt; triggers auto-converting "breed" to numeric so that the multiplication is possible. If you are sure, that an char-variable can be converted to numeric, use the input-function. That way you don't get tons of notes in the log and with the proper format you can convert non-english numbers to numbers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data demo;
   a = '1.016,052';
   b = input(a, commax15.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Feb 2018 07:45:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Convert-variable-to-character/m-p/438348#M69087</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-02-19T07:45:19Z</dc:date>
    </item>
  </channel>
</rss>

