<?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: Convert all character variables to numeric and use the same variable names in the output data se in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720219#M223092</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data mytable; /* Reconstruct mytable from input at SAS Communities */
infile cards missover;
input NAME &amp;amp; $18.	TYPE  	newname &amp;amp; $21.;
cards;
group	2	group_n
asm_score	2	asm_score_n
kas_bsn	 2	kas_bsn_n
kas_dsnr	2	kas_dsnr_n
kas_health_patient	2	kas_health_patient_n
;
data have; /* Example of actual data set */
    input (group asm_score kas_bsn kas_dsnr kas_health_patient)($);
    cards;
1 1 1 1 1
;
proc sql;
    select name,newname into :c_list separated by ' ',:n_list separated by ' ' from mytable;
quit;
%put &amp;amp;=c_list;
%put &amp;amp;=n_list; 

data _null_; /* Use CALL EXECUTE to create data set WANT from data set HAVE */
    set mytable end=eof;
    if _n_=1 then call execute('data want; set have;                                               
   array ch(*) $ &amp;amp;c_list;                                    
   array nu(*) &amp;amp;n_list;                                      
   do i = 1 to dim(ch);                                      
      nu(i)=input(ch(i),8.);                                  
   end;                                                      
   drop i &amp;amp;c_list;                                           
   rename ');                                                                             
    call execute(cats(newname,'=',name));
    if eof then call execute (';run;');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 18 Feb 2021 15:39:32 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-02-18T15:39:32Z</dc:date>
    <item>
      <title>Convert all character variables to numeric and use the same variable names in the output data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720186#M223071</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;
&lt;P&gt;am tring to convert all character variables to numeric in my table. I saw a very nice post on SAS support. Which I think will perfectly work for me. My only problem is that I get an error message saying:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR: The length of the value of the macro variable RENAM_LIST (65540) exceeds the maximum&lt;BR /&gt;length (65534). The value has been truncated to 65534 characters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select trim(left(name)), trim(left(newname)),
trim(left(newname))||'='||trim(left(name))
into :c_list separated by ' ', :n_list separated by ' ',
:renam_list separated by ' '

from mytable;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I tried to use length= 65534 behind &lt;CODE class=" language-sas"&gt;:renam_list separated by ' '&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but it seems to be the wrong syntax. Is it&amp;nbsp;any way possible to assign&amp;nbsp; lengths to c_list, n_list and renam_list here?&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 14:29:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720186#M223071</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2021-02-18T14:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all character variables to numeric and use the same variable names in the output data se</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720188#M223072</link>
      <description>&lt;P&gt;The problem is that you are creating a macro variable, and macro variables anywhere in SAS cannot exceed a certain length of 65534 characters. This is not something you can change.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I had this problem once. I wound up using CALL EXECUTE and then there are no limits. You could also split dataset MYTABLE into smaller parts and then the SQL solution will work, but you will have to run it twice or more (once on each split).&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 14:29:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720188#M223072</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-02-18T14:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all character variables to numeric and use the same variable names in the output data se</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720194#M223074</link>
      <description>&lt;P&gt;Thanks for the hint:&lt;/P&gt;
&lt;P&gt;What is the proper way of using call execute in this case?&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 14:42:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720194#M223074</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2021-02-18T14:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all character variables to numeric and use the same variable names in the output data se</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720195#M223075</link>
      <description>&lt;P&gt;Please provide a small portion of data set MYTABLE (2 or 3 rows ought to be fine)&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 14:48:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720195#M223075</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-02-18T14:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all character variables to numeric and use the same variable names in the output data se</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720201#M223076</link>
      <description>&lt;TABLE width="486"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="192"&gt;NAME&lt;/TD&gt;
&lt;TD width="90"&gt;TYPE&lt;/TD&gt;
&lt;TD width="204"&gt;newname&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;group&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;group_n&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;asm_score&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;asm_score_n&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;kas_bsn&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;kas_bsn_n&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;kas_dsnr&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;kas_dsnr_n&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;kas_health_patient&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;kas_health_patient_n&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Thu, 18 Feb 2021 14:59:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720201#M223076</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2021-02-18T14:59:44Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all character variables to numeric and use the same variable names in the output data se</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720203#M223078</link>
      <description>&lt;P&gt;You need to show how you are using those macro variables to get a fully worked solution, but in general you can just use a DATA step to generate the code directly instead of first making macro variables.&amp;nbsp; &amp;nbsp;Since you were generating three lists you will probably need to process the dataset MYTABLE at least three times to generate all of the code, once for each place in the generated code where you were using the macro variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But here is a trick for generating a really long list into a macro variable.&amp;nbsp; What you can do is generate many shorter macro variables and generate one macro variable that references the others.&amp;nbsp; So for your example you might generate something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;c1=var1 var2
c2=var3 var4
n1=new1 new2
n2=new3 new4
r1=new1=var1 new2=var2
r2=new3=var3 new4=var4
c_list=&amp;amp;c1 &amp;amp;c2
n_list=&amp;amp;n1 &amp;amp;n2
renam_list=&amp;amp;r1 &amp;amp;r2&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now when you reference &amp;amp;C_LIST you will get var1 var2 var3 var4 .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on your SQL you could do use code something like this to generate those macro variables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let c_list=;
%let n_list=
%let renam_list=;

data _null_;
  row+1;
  length c n r $32000;
  do until(eof or length(r) &amp;gt; 30000);
    set mytable end=eof ;
    c=catx(' ',c,name);
    n=catx(' ',c,newname);
    r=catx(' ',catx('=',newname,name);
  end;
  call symputx(cats('c',row),c);
  call symputx(cats('n',row),n);
  call symputx(cats('r',row),r);
  call symputx('c_list',catx(' ',symget('c_list'),cats('&amp;amp;c',row)));
  call symputx('n_list',catx(' ',symget('n_list'),cats('&amp;amp;n',row)));
  call symputx('renam_list',catx(' ',symget('renam_list'),cats('&amp;amp;r',row)));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 15:14:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720203#M223078</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-02-18T15:14:29Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all character variables to numeric and use the same variable names in the output data se</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720207#M223081</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/168930"&gt;@Anita_n&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where do you change the character variables to numeric variables in your process? I only see renaming.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 15:12:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720207#M223081</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-02-18T15:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all character variables to numeric and use the same variable names in the output data se</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720209#M223083</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;                                               
   set have;                                                 
   array ch(*) $ &amp;amp;c_list;                                    
   array nu(*) &amp;amp;n_list;                                      
   do i = 1 to dim(ch);                                      
      nu(i)=input(ch(i),8.);                                  
   end;                                                      
   drop i &amp;amp;c_list;                                           
   rename &amp;amp;renam_list;                                                                                      
run;             
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Feb 2021 15:16:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720209#M223083</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2021-02-18T15:16:53Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all character variables to numeric and use the same variable names in the output data se</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720210#M223084</link>
      <description>&lt;P&gt;I get the following errors on running the code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR: Open code statement recursion detected.&lt;BR /&gt;1775&lt;BR /&gt;1776 data _null_;&lt;BR /&gt;1777 row+1;&lt;BR /&gt;---&lt;BR /&gt;180&lt;/P&gt;
&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;
&lt;P&gt;1778 length c n r $32000;&lt;BR /&gt;------&lt;BR /&gt;180&lt;/P&gt;
&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 15:19:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720210#M223084</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2021-02-18T15:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all character variables to numeric and use the same variable names in the output data se</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720211#M223085</link>
      <description>&lt;P&gt;So you only need one pass through the dataset to generate code that does that, but the code will look different. Instead of using array just generate separate assignment, rename and drop statements.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;                                               
   set have;   
new1=input(old1,32.);
rename new1=old1;
drop old1;
new2=input(old2,32.);
rename old2=new2;
drop old2;
....
run;          &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So you might use code like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename code temp;
data _null_;
  set mytable;
  file code;
  put name '=input(' oldname ',32.); rename ' name oldname '; drop ' oldname ';' ;
run;

data want;
  set have ;
%include code / source2;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Feb 2021 15:21:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720211#M223085</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-02-18T15:21:48Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all character variables to numeric and use the same variable names in the output data se</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720213#M223087</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/168930"&gt;@Anita_n&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I get the following errors on running the code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR: Open code statement recursion detected.&lt;BR /&gt;1775&lt;BR /&gt;1776 data _null_;&lt;BR /&gt;1777 row+1;&lt;BR /&gt;---&lt;BR /&gt;180&lt;/P&gt;
&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;
&lt;P&gt;1778 length c n r $32000;&lt;BR /&gt;------&lt;BR /&gt;180&lt;/P&gt;
&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Something before what you posted is the issue. Your truncated macro variables you generated before might have left your SAS session unstable.&amp;nbsp; Re-start SAS and try again.&amp;nbsp; If you get an error include more of the log so that it is possible to see the cause.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 15:25:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720213#M223087</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-02-18T15:25:25Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all character variables to numeric and use the same variable names in the output data se</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720219#M223092</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data mytable; /* Reconstruct mytable from input at SAS Communities */
infile cards missover;
input NAME &amp;amp; $18.	TYPE  	newname &amp;amp; $21.;
cards;
group	2	group_n
asm_score	2	asm_score_n
kas_bsn	 2	kas_bsn_n
kas_dsnr	2	kas_dsnr_n
kas_health_patient	2	kas_health_patient_n
;
data have; /* Example of actual data set */
    input (group asm_score kas_bsn kas_dsnr kas_health_patient)($);
    cards;
1 1 1 1 1
;
proc sql;
    select name,newname into :c_list separated by ' ',:n_list separated by ' ' from mytable;
quit;
%put &amp;amp;=c_list;
%put &amp;amp;=n_list; 

data _null_; /* Use CALL EXECUTE to create data set WANT from data set HAVE */
    set mytable end=eof;
    if _n_=1 then call execute('data want; set have;                                               
   array ch(*) $ &amp;amp;c_list;                                    
   array nu(*) &amp;amp;n_list;                                      
   do i = 1 to dim(ch);                                      
      nu(i)=input(ch(i),8.);                                  
   end;                                                      
   drop i &amp;amp;c_list;                                           
   rename ');                                                                             
    call execute(cats(newname,'=',name));
    if eof then call execute (';run;');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Feb 2021 15:39:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720219#M223092</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-02-18T15:39:32Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all character variables to numeric and use the same variable names in the output data se</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720226#M223097</link>
      <description>&lt;P&gt;That will reduce the likely hood of exceeding macro variable limit, but not eliminate it.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 15:48:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720226#M223097</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-02-18T15:48:06Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all character variables to numeric and use the same variable names in the output data se</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720228#M223098</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;, yes, but in the original example, it was the longer macro variable&amp;nbsp;@RENAM_LIST that was the problem, not the shorter macro variables. I suppose if the real example &amp;amp;C_LIST is too long then some other code would be needed. But doesn't your code suffer from the same limitation?&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 15:57:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720228#M223098</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-02-18T15:57:16Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all character variables to numeric and use the same variable names in the output data se</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720235#M223103</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;, yes, but in the original example, it was the longer macro variable&amp;nbsp;@RENAM_LIST that was the problem, not the shorter macro variables. I suppose if the real example &amp;amp;C_LIST is too long then some other code would be needed. But doesn't your code suffer from the same limitation?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The data step to generate the code I posted does not use macro variables at all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The data step to generate multiple macro variables will hit a limit but it is much larger.&amp;nbsp; If we assume that the rename strings require 66 characters per rename pair (32*2 plus space and equal sign) we can fit 484 pairs into each macro variable R1,R2,....&amp;nbsp; We can reference at least 3000 macro variables in the 32K character limit for the generated RENAM_LIST macro variable. So it will work for at a minimum or 1.4 million pairs or variable names.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 16:11:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720235#M223103</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-02-18T16:11:27Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all character variables to numeric and use the same variable names in the output data se</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720236#M223104</link>
      <description>&lt;P&gt;I need to test the methods patiently to see which works for me. I will let you know then when am done.&lt;/P&gt;
&lt;P&gt;Thankyou both for the help.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 16:15:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720236#M223104</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2021-02-18T16:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all character variables to numeric and use the same variable names in the output data se</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720239#M223107</link>
      <description>&lt;P&gt;Maybe it is worth discussing prevention vs fixing.&lt;/P&gt;
&lt;P&gt;WHY are all the variables you want as numeric currently character? If this was the result of an incorrect file import then perhaps the better method would be to correct the read step instead of fixing it afterwards.&lt;/P&gt;
&lt;P&gt;Or possibly even EXPORT the data to a text formatted file and write a data step to read that back in with the desired properties.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One moderately frequent cause of variables that should be numeric coming into SAS as character is use of Proc Import with a file that uses some sort of text like NULL or NA for what should be missing values. That can be dealt with using a custom informat and data step to read the values the first time around.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 16:19:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720239#M223107</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-02-18T16:19:33Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all character variables to numeric and use the same variable names in the output data se</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720267#M223113</link>
      <description>&lt;P&gt;The data comes from Postgresql and contains 1634 variables and 1985 observations. The variable names are very long and have special characters. I have tried all means to use sas to import but no way.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I ended up using stattransfer to import this to sas. I realise that, all my num vars are converted to char. Dates to chars. For the issue with the dates I have been able to solve it. some decimal values like 4.2 are converted to 4.Feb&lt;/P&gt;
&lt;P&gt;It isn't easy to edit this file, even though it's a delimited file (semicolon seperated)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the most tedious part are the long varnames&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 16:41:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720267#M223113</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2021-02-18T16:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all character variables to numeric and use the same variable names in the output data se</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720272#M223115</link>
      <description>&lt;P&gt;You can connect SAS to Postgres.&amp;nbsp; It will require at least SAS/Access to ODBC license.&lt;/P&gt;
&lt;P&gt;If the variable names are longer than 32 bytes then you will have issues.&amp;nbsp; Same with table (dataset) names. But you can work around that with pass thru code so they rename them on the remote side before pulling them into SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have values being converted to dates then you have probably accidentally opened a delimited file with Excel, I doubt that STAT/Transfer would do that itself.&amp;nbsp; &lt;STRONG&gt;Do NOT let EXCEL automatically open a delimited&amp;nbsp; file.&lt;/STRONG&gt;&amp;nbsp; If you do open it with Excel make sure to do it under control so that you can tell it how to treat each column in the delimited file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have a delimited file then read it directly with SAS data step. Then you have total control over the variable names, type and length.&amp;nbsp; You can control how the text in the file is converted to the values stored in the SAS variables. You can control what SAS formats are attached the variables (if there is any need to attach any formats to any of the variables).&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 17:17:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720272#M223115</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-02-18T17:17:57Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all character variables to numeric and use the same variable names in the output data se</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720274#M223117</link>
      <description>&lt;P&gt;Yes, you are right but in my case the data step does work properly because of the problem with the variables. I cannot connect directly to postgresql because the data is from an external body who works with postgresql. I receive just the delimited file from them&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 17:31:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-character-variables-to-numeric-and-use-the-same/m-p/720274#M223117</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2021-02-18T17:31:13Z</dc:date>
    </item>
  </channel>
</rss>

