<?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 all numeric columns to character columns in one shot using SAS in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159164#M12389</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please accept my apologies if the phrasing in my most recent posting appears addressed to you.&lt;/P&gt;&lt;P&gt;I really meant to be addressing the original poster.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;kind regards&lt;/P&gt;&lt;P&gt;and compliments of the season&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;peterC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 22 Dec 2014 16:38:13 GMT</pubDate>
    <dc:creator>Peter_C</dc:creator>
    <dc:date>2014-12-22T16:38:13Z</dc:date>
    <item>
      <title>How to convert all numeric columns to character columns in one shot using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159149#M12374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; background-color: #ffffff;"&gt;Hi all, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; background-color: #ffffff;"&gt;I have a huge data base including (3000 columns, 500000 rows). Some of the columns are Numeric and some Character. For some reason I want to convert all numeric to characters in my data and retain the order and name of the columns. I know some stuff about how to convert columns one by one but I am looking for a program to do this in one shot. Any help would be appreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Dec 2014 02:29:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159149#M12374</guid>
      <dc:creator>MAXISAS</dc:creator>
      <dc:date>2014-12-21T02:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert all numeric columns to character columns in one shot using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159150#M12375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is a untested code, you may try using arrays as below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt; array nu(*)&amp;nbsp; _numeric_;&lt;/P&gt;&lt;P&gt; array ch(*) $ character1-characterxx;&lt;/P&gt;&lt;P&gt;do i = 1 to dim(nu);&lt;/P&gt;&lt;P&gt;if nu(i) ne . then ch(i)=put(n(i),best.);&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jag&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Dec 2014 02:53:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159150#M12375</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2014-12-21T02:53:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert all numeric columns to character columns in one shot using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159151#M12376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote" modifiedtitle="true"&gt;
&lt;P&gt;MAXISAS wrote:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 1.5em;"&gt;For some reason I want to convert all numeric to characters in my data and retain the order and name of the columns. &lt;/SPAN&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some reason?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Dec 2014 03:27:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159151#M12376</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-12-21T03:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert all numeric columns to character columns in one shot using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159152#M12377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try just running two proc transpose steps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; have ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; a b $&lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;10&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; c d &lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;8&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; e f $&lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;10&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; a--f ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;label&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; c=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'Middle var'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;x y 1 2 z 4&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;transpose&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=have &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=middle ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;var&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;_all_&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;transpose&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=middle &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=want (drop=_name_);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;var&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; col1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;print&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;; &lt;/SPAN&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Dec 2014 04:37:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159152#M12377</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-12-21T04:37:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert all numeric columns to character columns in one shot using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159153#M12378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tom,&lt;/P&gt;&lt;P&gt;OP said he have a huge table . It is not possible for proc transpose under that scenario .&lt;/P&gt;&lt;P&gt;I think SQL is a better choice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;
data have ;
&amp;nbsp;&amp;nbsp; length a b $10 c d 8 e f $10 ;
&amp;nbsp;&amp;nbsp; input a--f ;
&amp;nbsp;&amp;nbsp; label c='Middle var';
cards;
x y 1 2 z 4
;
run;

data _null_;
 set sashelp.vcolumn(keep=libname memname name type where=(libname='WORK' and memname='HAVE')) end=last;
 if _n_ eq 1 then call execute('proc sql; create table want as select ');
 if type='char' then call execute(name);
&amp;nbsp; else call execute('put('||strip(name)||',best32. -l) as '||strip(name));
 if not last then call execute(',');
&amp;nbsp; else call execute(' from have;quit;');
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Dec 2014 06:14:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159153#M12378</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-12-21T06:14:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert all numeric columns to character columns in one shot using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159154#M12379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You solutions ignores the underlying format associated with each variable you may need to address that deficiency in your program.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Converting with format is where PROC TRANSPOSE has an advantage although the amount of data and variables may be too much as you suggest.&amp;nbsp; I reckon the OP needs to decide what is important and perhaps give more details about the conversion from numeric to character.&amp;nbsp; Maybe for a "some reason" conversion best 32 is adequate we may never know.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Dec 2014 16:39:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159154#M12379</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2014-12-21T16:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert all numeric columns to character columns in one shot using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159155#M12380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree with DN and think that the number of variables limitation can be overcome by inserting a counter. e.g.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; length a b $10 c d 8 e f $10 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; input a--f ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; label c='Middle var';&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;x y 1 2 z 4&lt;/P&gt;&lt;P&gt;a b 3.3754 2.842 y 77.5&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data need;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; counter+1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc transpose data=need out=middle (where=(_name_ ne 'counter')) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var _all_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by counter;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data middle;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set middle;&lt;/P&gt;&lt;P&gt;&amp;nbsp; col1=left(col1);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc transpose data=middle out=want (drop=counter _name_);&lt;/P&gt;&lt;P&gt;var col1;&lt;/P&gt;&lt;P&gt;by counter;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Dec 2014 17:04:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159155#M12380</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-12-21T17:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert all numeric columns to character columns in one shot using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159156#M12381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="60904" __jive_macro_name="thread" class="jive_macro jive_macro_thread" href="https://communities.sas.com/"&gt;&lt;/A&gt; I found this on a random search. this may help?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Dec 2014 19:01:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159156#M12381</guid>
      <dc:creator>naveen_srini</dc:creator>
      <dc:date>2014-12-21T19:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert all numeric columns to character columns in one shot using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159157#M12382</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you all for your generous helps. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Dec 2014 22:20:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159157#M12382</guid>
      <dc:creator>MAXISAS</dc:creator>
      <dc:date>2014-12-21T22:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert all numeric columns to character columns in one shot using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159158#M12383</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello again, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am going to explain a little more about the data and why I want this conversion. As I said the database have almost 3000 columns and I dont know which one is numeric and which one is character (unless I go through them one by one). I was just hoping the code can figure it out itself and transform it. &lt;/P&gt;&lt;P&gt;The whole reason that I am doing this is that I have 20 databases all have the same 2988 variables (the name of variables among all 20 files are the same) and I want to append them together. The important point is that since there are some mistakes in the content of variables (for example variable 13), the type of variables are not the same. For example, variable 13 has numeric type in database 4 and has character type in database 17. when SAS wants to append them together, they put missing data if there is any mismatch. I just want to append all these 20 files without having any missing data even if the data are not matched (cause I can fixed them later). This was the reason I want to convert all my files to character and then append them to avoid loosing any data when I SAS append them together.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks all you guys in advance for your helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bests &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Dec 2014 23:18:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159158#M12383</guid>
      <dc:creator>MAXISAS</dc:creator>
      <dc:date>2014-12-21T23:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert all numeric columns to character columns in one shot using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159159#M12384</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If they are actually in text files instead of a database then just read them in as text to begin with.&lt;/P&gt;&lt;P&gt;For example if they are all in CSV files then you could even possibly read them all in one data step.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile '*.csv' dsd truncover lrecl=32000 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length var1-var3000 $200 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input var1-var3000 ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Dec 2014 00:14:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159159#M12384</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-12-22T00:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert all numeric columns to character columns in one shot using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159160#M12385</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Tom,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually I have a big file which is csv. and your answer worked. Is it possible to import first line of csv file as variable names in this code?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bests&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Dec 2014 01:28:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159160#M12385</guid>
      <dc:creator>MAXISAS</dc:creator>
      <dc:date>2014-12-22T01:28:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert all numeric columns to character columns in one shot using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159161#M12386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp; Arthur.T ,&lt;/P&gt;&lt;P&gt;It is easy for SQL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;

 
data have ;
&amp;nbsp;&amp;nbsp; length a b $10 c d 8 e f $10 ;
&amp;nbsp;&amp;nbsp; input a--f ;
&amp;nbsp;&amp;nbsp; format d z4.;
&amp;nbsp;&amp;nbsp; label c='Middle var';
cards;
x y 1 2 z 4
;
run;

data _null_;
 set sashelp.vcolumn(keep=libname memname name type label format where=(libname='WORK' and memname='HAVE')) end=last;
 if _n_ eq 1 then call execute('proc sql; create table want as select ');
 if type='char' then call execute(strip(name)||' label="'||strip(label)||'"');
&amp;nbsp; else call execute('strip(put('||strip(name)||','||coalescec(strip(format),'best32.')||')) as '||strip(name)||' label="'||strip(label)||'"');
 if not last then call execute(',');
&amp;nbsp; else call execute(' from have;quit;');
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Dec 2014 10:20:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159161#M12386</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-12-22T10:20:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert all numeric columns to character columns in one shot using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159162#M12387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Usually I just pull the first line into the editor and convert it to a LENGTH statement.&amp;nbsp; For example if it is comma delimited I change the commas to spaces. Then program looks like.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data want ;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; infile 'myfile.csv' dsd truncover lrecl=32000 ;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; length firstvar nextvar ..... lastvar $200 ;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; input firstvar -- lastvar&amp;nbsp; ;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;If that is too hard you can read the first line with a program and write the names to the log or another file.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data _null_;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; infile 'myfile.csv' obs=1 dsd truncover ;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; file 'myfile.names' ;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; length name $32 ;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; do until (name=' ' );&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; input name @;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; put name;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Dec 2014 15:38:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159162#M12387</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-12-22T15:38:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert all numeric columns to character columns in one shot using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159163#M12388</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I know you have moved on from the subject line (converting numerics ) to reading from .csv, but just before trying to add value on INPUT consider that SAS makes it easy to convert numbers to strings.&lt;/P&gt;&lt;P&gt;data strings ;&lt;/P&gt;&lt;P&gt; set your.data;&lt;/P&gt;&lt;P&gt; file 'a strings file.txt' dsd lrecl=1000000;&lt;/P&gt;&lt;P&gt; Put (_all_)(:);&lt;/P&gt;&lt;P&gt;run ;&lt;/P&gt;&lt;P&gt;But you want to read......&lt;/P&gt;&lt;P&gt;Suppose you have file big.csv&lt;/P&gt;&lt;P&gt;you are happy to read all cols as string, but want to see their col names.&lt;/P&gt;&lt;P&gt;Have a go with&lt;/P&gt;&lt;P&gt;Data bigstrings(compress=yes);&lt;/P&gt;&lt;P&gt;Infile "big.csv" dsd lrecl=1000000 dlm=','&amp;nbsp; truncover ;&lt;/P&gt;&lt;P&gt;input (col1-col3000 )( :$200. ) ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;You will see the column headings in thr first row.&lt;/P&gt;&lt;P&gt;That could be followed with a step to prepare "renaming" from that row....&lt;/P&gt;&lt;P&gt;data _null_ ;&lt;/P&gt;&lt;P&gt;Filename gencode "%sysfunc(pathname(work))/gencode.sas" ;&lt;/P&gt;&lt;P&gt;File gencode ;&lt;/P&gt;&lt;P&gt;set bigstrings( obs= 1 );&lt;/P&gt;&lt;P&gt;put 'proc datasets nolist lib=work; ' &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; / ' modify bigstrings ; rename ' ;&lt;/P&gt;&lt;P&gt;Array col(*) ;&lt;/P&gt;&lt;P&gt;Do c= 1 to dim(col) ;&lt;/P&gt;&lt;P&gt;if not nvalid( col(c), 'V7' ) then continue ;&lt;/P&gt;&lt;P&gt;Put col(c)= ;&lt;/P&gt;&lt;P&gt;End ;&lt;/P&gt;&lt;P&gt;Put ' ; run; quit; ' ;&lt;/P&gt;&lt;P&gt;Stop;&lt;/P&gt;&lt;P&gt;Run;&lt;/P&gt;&lt;P&gt;* now apply the renaming;&lt;/P&gt;&lt;P&gt;%include gencode ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Dec 2014 16:31:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159163#M12388</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2014-12-22T16:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert all numeric columns to character columns in one shot using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159164#M12389</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please accept my apologies if the phrasing in my most recent posting appears addressed to you.&lt;/P&gt;&lt;P&gt;I really meant to be addressing the original poster.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;kind regards&lt;/P&gt;&lt;P&gt;and compliments of the season&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;peterC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Dec 2014 16:38:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159164#M12389</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2014-12-22T16:38:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert all numeric columns to character columns in one shot using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159165#M12390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sascommunity.org/wiki/Convert_Numeric_Variables_to_Character" title="http://www.sascommunity.org/wiki/Convert_Numeric_Variables_to_Character"&gt;Convert Numeric Variables to Character - sasCommunity&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, the technique might be defeated by the sheer number of columns.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Dec 2014 17:16:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159165#M12390</guid>
      <dc:creator>Howles</dc:creator>
      <dc:date>2014-12-22T17:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert all numeric columns to character columns in one shot using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159166#M12391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks everyone for their generous answer, I have one more question which is how to append two datasets (lets say data1 and data1) which has the same number of rows append horizontally (I dont want to merge or sort just glue two files horizontally)? thanks for your help in advance &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;btw, Im new to this website and I dont know if I should make new discussion if I have question or just continue to ask questions on the same discussion?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bests&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Dec 2014 22:13:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159166#M12391</guid>
      <dc:creator>MAXISAS</dc:creator>
      <dc:date>2014-12-22T22:13:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert all numeric columns to character columns in one shot using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159167#M12392</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should make a new discussion and mark the correct/helpful answers in this post. If none are the exact answer, check your first post to mark the question: Assumed Answered.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Dec 2014 22:15:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159167#M12392</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-12-22T22:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert all numeric columns to character columns in one shot using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159168#M12393</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You really should ask new questions by starting a new discussion, as well as give people credit for providing responses (i.e., helpful and correct where applicable).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, assuming your two files are data1 and data2, you can "glue" them together by using a datastep. e.g.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt; set data1;&lt;/P&gt;&lt;P&gt; set data2;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course, you may have to drop or rename some variables in the event variables of the same name exist in the two datasets.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Dec 2014 22:18:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-all-numeric-columns-to-character-columns-in-one/m-p/159168#M12393</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-12-22T22:18:14Z</dc:date>
    </item>
  </channel>
</rss>

