<?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 deal with multiple different column names in an effecient way in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-deal-with-multiple-different-column-names-in-an-effecient/m-p/285133#M58236</link>
    <description>&lt;P&gt;Yes ... But it depends on what you want to do. Common tasks are adding a prefix or suffix, renaming based on lookup table, or adding labels.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many of these can be automated by leveraging some basic macro variables and using sashelp.vcolumn/dictionary.column table.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you've never used the dictionary tables navigate to the sashelp library and take a look at .vtable vcolumn tables which have metadata about all your SAS datasets.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 17 Jul 2016 22:20:44 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-07-17T22:20:44Z</dc:date>
    <item>
      <title>How to deal with multiple different column names in an effecient way</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-deal-with-multiple-different-column-names-in-an-effecient/m-p/285132#M58235</link>
      <description>&lt;P&gt;I need to change something with all the variables in my dataset, but there are around 100 variables and at the same time, the column names are very different and irregular , for example, ws &amp;nbsp;tsfg &amp;nbsp;ttt &amp;nbsp;etttt ssdf &amp;nbsp;tkw &amp;nbsp;trp.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course I can't do&amp;nbsp;the same behavior for each variable for 100 times. I am wondering is there an efficient way to do with the irregular variable names?&lt;/P&gt;</description>
      <pubDate>Sun, 17 Jul 2016 21:48:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-deal-with-multiple-different-column-names-in-an-effecient/m-p/285132#M58235</guid>
      <dc:creator>DingDing</dc:creator>
      <dc:date>2016-07-17T21:48:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to deal with multiple different column names in an effecient way</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-deal-with-multiple-different-column-names-in-an-effecient/m-p/285133#M58236</link>
      <description>&lt;P&gt;Yes ... But it depends on what you want to do. Common tasks are adding a prefix or suffix, renaming based on lookup table, or adding labels.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many of these can be automated by leveraging some basic macro variables and using sashelp.vcolumn/dictionary.column table.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you've never used the dictionary tables navigate to the sashelp library and take a look at .vtable vcolumn tables which have metadata about all your SAS datasets.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Jul 2016 22:20:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-deal-with-multiple-different-column-names-in-an-effecient/m-p/285133#M58236</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-07-17T22:20:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to deal with multiple different column names in an effecient way</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-deal-with-multiple-different-column-names-in-an-effecient/m-p/285134#M58237</link>
      <description>&lt;P&gt;If your recoding or doing some sort of calculation you can also use arrays and short references such as&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Array var_list(*) first_var -- last_var ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this will include all variables from first to last based on variable portion.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Jul 2016 22:22:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-deal-with-multiple-different-column-names-in-an-effecient/m-p/285134#M58237</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-07-17T22:22:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to deal with multiple different column names in an effecient way</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-deal-with-multiple-different-column-names-in-an-effecient/m-p/285135#M58238</link>
      <description>&lt;P&gt;Assuming you have a list of name equivalents, transform that list into a macro variable which can be inserted in a rename statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data names;
length oldName newName $32;
input oldName newName;
datalines;
weight kilos
height inches
age years
name firstName
sex gender
;

proc sql;
select catx("=", oldName, newName) into : rename separated by " "
from names;
quit;

data myClass;
set sashelp.class;
rename &amp;amp;rename;
run;

proc contents data=myClass; run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 17 Jul 2016 22:24:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-deal-with-multiple-different-column-names-in-an-effecient/m-p/285135#M58238</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-07-17T22:24:25Z</dc:date>
    </item>
  </channel>
</rss>

