<?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: How to convert numeric variable to character without adding or dropping in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-numeric-variable-to-character-without-adding-or/m-p/444029#M111122</link>
    <description>&lt;P&gt;You may get away with using the DBSASTYPE option:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data new;
  set dblib.mydata(dbsastype=(orig_var='CHAR(8)'));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 09 Mar 2018 08:40:03 GMT</pubDate>
    <dc:creator>s_lassen</dc:creator>
    <dc:date>2018-03-09T08:40:03Z</dc:date>
    <item>
      <title>How to convert numeric variable to character without adding or dropping</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-numeric-variable-to-character-without-adding-or/m-p/443942#M111101</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset that has variable&amp;nbsp;that is&amp;nbsp;originally a numeric in the sql server I pull it from.&amp;nbsp;I want to change this variable to a character without changing the order of the variables. &amp;nbsp;I know of the put/drop/rename syntax like this:&lt;BR /&gt;&lt;BR /&gt;data new;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; orig_var = 189;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; new_var = put(orig_var,8.);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; drop orig_var;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; rename new_var = orig_var;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But i am trying to do this without having the variables change order, and the above syntax moves the "new_var" to the end of the dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;that dataset looks like this:&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;company&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;month&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;people&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;A&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;3&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;232&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;B&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;53&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;C&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;5&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;646&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;D&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;9&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;244&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;E&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;12&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2609&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my goal is to have "month" changed to a character value without having to use a RETAIN step afterwards to regain the original order of the variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for any help you could provide.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 00:53:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-numeric-variable-to-character-without-adding-or/m-p/443942#M111101</guid>
      <dc:creator>huffa9299</dc:creator>
      <dc:date>2018-03-09T00:53:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert numeric variable to character without adding or dropping</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-numeric-variable-to-character-without-adding-or/m-p/443963#M111105</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
&amp;nbsp; create table WANT as&amp;nbsp;
&amp;nbsp; select&amp;nbsp;VAR1, VAR2, put(VAR3,8.) as&amp;nbsp;VAR3, VAR4
&amp;nbsp;&amp;nbsp;from HAVE;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 03:16:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-numeric-variable-to-character-without-adding-or/m-p/443963#M111105</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-03-09T03:16:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert numeric variable to character without adding or dropping</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-numeric-variable-to-character-without-adding-or/m-p/444029#M111122</link>
      <description>&lt;P&gt;You may get away with using the DBSASTYPE option:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data new;
  set dblib.mydata(dbsastype=(orig_var='CHAR(8)'));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Mar 2018 08:40:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-numeric-variable-to-character-without-adding-or/m-p/444029#M111122</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2018-03-09T08:40:03Z</dc:date>
    </item>
  </channel>
</rss>

