<?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: Automatically rename columns in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Automatically-rename-columns/m-p/247168#M17533</link>
    <description>&lt;P&gt;I see the variable name in&amp;nbsp;&lt;SPAN&gt;metadata file is not exactly matched the name in sas table .&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Is there any rule to map them . and Better post some sample data to enable&amp;nbsp;us to test .&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 01 Feb 2016 09:13:07 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2016-02-01T09:13:07Z</dc:date>
    <item>
      <title>Automatically rename columns</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Automatically-rename-columns/m-p/247158#M17529</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table that I imported from excel into EG. This table is a description of my metadata.&lt;/P&gt;&lt;P&gt;It contains the tablenames/fieldnames but also their 'readable' descriptions of the tables/fields.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there an easy to query my data to this metadata-table and automatically convert my columnnames to the descriptions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm finding it difficult to describe my problem so I do hope i'm making any sense.&lt;/P&gt;&lt;P&gt;I have&amp;nbsp;attached some screenshots.&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12259i3B8C636744DCEFCA/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="table description.jpg" title="table description.jpg" /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12260i2AE23CC017A263EE/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="table.jpg" title="table.jpg" /&gt;</description>
      <pubDate>Mon, 01 Feb 2016 07:19:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Automatically-rename-columns/m-p/247158#M17529</guid>
      <dc:creator>Erwinb</dc:creator>
      <dc:date>2016-02-01T07:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically rename columns</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Automatically-rename-columns/m-p/247166#M17531</link>
      <description>&lt;P&gt;I would strongly advise against using the descriptions as column names, as they are not valid Base SAS names (alphabetic characters, numbers and underlines, no special characters and blanks allowed). While this is possible, it then constantly forces you to use the 'some interesting name'n construct when accessing columns.&lt;/P&gt;
&lt;P&gt;Instead, you should set the column labels to the descriptions, as SAS output procedures can usually be directed to show the labels instead of the names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, once you have your description table in SAS, you could do the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set description_table end=done;
length execute_str $ 2000;
execute_str = catx(' ',trim(execute_str),trim(fieldname)!!'="'!!trim(description)!!'"');
if done then call symput('label_str',trim(execute_str));
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now you can use &amp;amp;label_str in a label statement.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2016 09:06:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Automatically-rename-columns/m-p/247166#M17531</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-02-01T09:06:15Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically rename columns</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Automatically-rename-columns/m-p/247168#M17533</link>
      <description>&lt;P&gt;I see the variable name in&amp;nbsp;&lt;SPAN&gt;metadata file is not exactly matched the name in sas table .&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Is there any rule to map them . and Better post some sample data to enable&amp;nbsp;us to test .&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2016 09:13:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Automatically-rename-columns/m-p/247168#M17533</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-02-01T09:13:07Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically rename columns</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Automatically-rename-columns/m-p/247171#M17534</link>
      <description>&lt;P&gt;One other option to the two answers provided above, is to have a normalised dataset, with the columns as parameters. &amp;nbsp;This is a common format in databases (and I am suprised to see a DB2 file with so many columns, doesn't seem like a good structure). &amp;nbsp;So if you have a file like this:&lt;/P&gt;
&lt;P&gt;VCDR_NR &amp;nbsp;VEST_KD &amp;nbsp; AFBO_NR...&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What your output dataset would look like is this:&lt;/P&gt;
&lt;P&gt;PARAM_CODE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; RESULT&lt;/P&gt;
&lt;P&gt;VCDR_NR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;...&lt;/P&gt;
&lt;P&gt;VEST_KD &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ...&lt;/P&gt;
&lt;P&gt;AFBO_NR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;...&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then it should be a relatively simple task to merge your metadata on to get labels for each param:&lt;/P&gt;
&lt;P&gt;PARAM_CODE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; RESULT &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PARAM&lt;/P&gt;
&lt;P&gt;VCDR_NR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;... &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Aan Vestiging&lt;/P&gt;
&lt;P&gt;VEST_KD &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ... &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ...&lt;/P&gt;
&lt;P&gt;AFBO_NR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;... &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will find this structure can be easier to work with, for instance, if your doing calculations across columns, you have arrays, but you need to know and supply variable names etc. &amp;nbsp;If you were to stick with the transposed approach - wide - as you have now, I would recommend, not labelling column names as data, but use a generic term, say VAR1-VARx for instance. &amp;nbsp;Names of columns are to make programming easier, labels of columns are there to provide information. &amp;nbsp;Make your programming far simpler by following one of the above approaches.&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2016 09:47:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Automatically-rename-columns/m-p/247171#M17534</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-02-01T09:47:27Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically rename columns</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Automatically-rename-columns/m-p/247235#M17538</link>
      <description>&lt;P&gt;Somewhat of a kludge, but I have been known to use a spreadsheet with column information and use that with spreadsheet functions to create a column of LABEL statements to apply to variables. Using a full description in a label makes a lot of sense as you can have more characters and characters that are not acceptable in variable names.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2016 15:59:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Automatically-rename-columns/m-p/247235#M17538</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-02-01T15:59:00Z</dc:date>
    </item>
  </channel>
</rss>

