<?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: Converting all variable types from character into numerical variables in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Converting-all-variable-types-from-character-into-numerical/m-p/754539#M29967</link>
    <description>&lt;P&gt;You forgot to use blanks in the SEPARATED BY clause.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why don't you make sure that the data is read correctly when you import it into SAS?&lt;/P&gt;</description>
    <pubDate>Fri, 16 Jul 2021 10:09:40 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-07-16T10:09:40Z</dc:date>
    <item>
      <title>Converting all variable types from character into numerical variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-all-variable-types-from-character-into-numerical/m-p/754510#M29962</link>
      <description>&lt;P&gt;I want to convert all the variable types in the table from characters into numerical types.&lt;/P&gt;&lt;P&gt;and here is the sample.&lt;/P&gt;&lt;P&gt;/*The sample dataset TEST contains both character and numeric variables*/&lt;BR /&gt;data test;&lt;BR /&gt;input id $ b c $ d e $ f;&lt;BR /&gt;datalines;&lt;BR /&gt;AAA 50 11 1 222 22&lt;BR /&gt;BBB 35 12 2 250 25&lt;BR /&gt;CCC 75 13 3 990 99&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;/*PROC CONTENTS is used to create an output dataset called VARS to list all*/&lt;BR /&gt;/*variable names and their type from the test dataset*/&lt;BR /&gt;PROC contents data=test out=vars(keep=name type) noprint;&lt;/P&gt;&lt;P&gt;data vars;&lt;BR /&gt;set vars;&lt;BR /&gt;if type=2 and name ne'id';&lt;BR /&gt;newname=trim(left(name))||"_n";&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;options symbolgen;&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;select trim(left(name)),trim(left(newname)),&lt;BR /&gt;trim(left(newname))||'='||trim(left(name))&lt;BR /&gt;into :c_list separated by '',:n_list separated by '',&lt;BR /&gt;:renam_list separated by ''&lt;BR /&gt;from vars;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;data test2;&lt;BR /&gt;set test;&lt;BR /&gt;array ch(*) $ &amp;amp;c_list;&lt;BR /&gt;array nu(*) $ &amp;amp;n_list;&lt;BR /&gt;do i=1 to dim(ch);&lt;BR /&gt;nu(i)=input(ch(i),8.);&lt;BR /&gt;end;&lt;BR /&gt;drop i &amp;amp;c_list;&lt;BR /&gt;rename &amp;amp;renam_list;&lt;BR /&gt;run;&lt;BR /&gt;proc contents data=test2;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But in the code line 'rename &amp;amp;renam_list',&lt;/P&gt;&lt;P&gt;when I run it in the 'log' session, I see the error below:&lt;/P&gt;&lt;DIV class="sasSource"&gt;SYMBOLGEN: Macro variable C_LIST resolves to ce&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;SYMBOLGEN: Macro variable RENAM_LIST resolves to c_n=ce_n=e&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;109 rename &amp;amp;renam_list;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Line generated by the macro variable "RENAM_LIST".&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;109 c_n=ce_n=e&lt;/DIV&gt;&lt;DIV class="sasError"&gt;_&lt;/DIV&gt;&lt;DIV class="sasError"&gt;22&lt;/DIV&gt;&lt;DIV class="sasError focus-line"&gt;ERROR 22-322: Expecting a name.&lt;/DIV&gt;&lt;DIV class="sasError focus-line"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasError focus-line"&gt;Could someone help me to solve this problem, what does 'Expecting a name' means in my situation?&lt;/DIV&gt;&lt;DIV class="sasError focus-line"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasError focus-line"&gt;Tks!!!&lt;/DIV&gt;</description>
      <pubDate>Fri, 16 Jul 2021 08:17:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-all-variable-types-from-character-into-numerical/m-p/754510#M29962</guid>
      <dc:creator>YR1415</dc:creator>
      <dc:date>2021-07-16T08:17:17Z</dc:date>
    </item>
    <item>
      <title>Re: Converting all variable types from character into numerical variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-all-variable-types-from-character-into-numerical/m-p/754539#M29967</link>
      <description>&lt;P&gt;You forgot to use blanks in the SEPARATED BY clause.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why don't you make sure that the data is read correctly when you import it into SAS?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 10:09:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-all-variable-types-from-character-into-numerical/m-p/754539#M29967</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-07-16T10:09:40Z</dc:date>
    </item>
  </channel>
</rss>

