<?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 How to update dynamically created variable names in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-update-dynamically-created-variable-names/m-p/446198#M111911</link>
    <description>&lt;P&gt;I have an dataset with&amp;nbsp; column names as&amp;nbsp; (id, server, windows_123,test_345,learn_678,.....etc) for current month. in next month i will have an dataset with different column names as (id, server, windows_abc,test_def,learn_ghi,.....etc). How can i rename the column names with like option and use the column names in my generating a report. Can any one suggest an option.&lt;/P&gt;</description>
    <pubDate>Fri, 16 Mar 2018 14:54:47 GMT</pubDate>
    <dc:creator>radha009</dc:creator>
    <dc:date>2018-03-16T14:54:47Z</dc:date>
    <item>
      <title>How to update dynamically created variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-update-dynamically-created-variable-names/m-p/446198#M111911</link>
      <description>&lt;P&gt;I have an dataset with&amp;nbsp; column names as&amp;nbsp; (id, server, windows_123,test_345,learn_678,.....etc) for current month. in next month i will have an dataset with different column names as (id, server, windows_abc,test_def,learn_ghi,.....etc). How can i rename the column names with like option and use the column names in my generating a report. Can any one suggest an option.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Mar 2018 14:54:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-update-dynamically-created-variable-names/m-p/446198#M111911</guid>
      <dc:creator>radha009</dc:creator>
      <dc:date>2018-03-16T14:54:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to update dynamically created variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-update-dynamically-created-variable-names/m-p/446205#M111918</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The rule to match columns from the second dataset to the first one is unclear.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming that columns names have a second part separated by an underscore,&lt;/P&gt;
&lt;P&gt;the following program renames columns by keeping only the part preceeding the&lt;/P&gt;
&lt;P&gt;underscore.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
    input windows_123 test_456;
    cards;
1 2
3 4
    ;
run;

data _NULL_;
    set sashelp.vcolumn end=eof;
    where libname="WORK" and memname="HAVE";

    if _N_=1 then do;
        call execute('data want; set have; rename');
    end;

    call execute(cats(NAME,'=',scan(NAME,1,"_")));

    if eof then do;
        call execute('; run;');
    end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Mar 2018 15:09:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-update-dynamically-created-variable-names/m-p/446205#M111918</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2018-03-16T15:09:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to update dynamically created variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-update-dynamically-created-variable-names/m-p/446218#M111925</link>
      <description>&lt;P&gt;Changing variable names in this fashion is an indication of poor data structuring and/or method of bringing the data into SAS. You would be better off to ensure that the variable names remain the same&amp;nbsp;at import and add a variable to indicate the date the data represents.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the files are text, such as CSV&amp;nbsp;or other delimited file or fixed column,&amp;nbsp;then a data step would easily accomplish this assuming the file layout does not change.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Mar 2018 15:28:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-update-dynamically-created-variable-names/m-p/446218#M111925</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-03-16T15:28:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to update dynamically created variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-update-dynamically-created-variable-names/m-p/446252#M111940</link>
      <description>&lt;P&gt;Thank you for quick respose.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When i ran i got the 0 observations.Also at rename how to provide without column names. my data cloumn names will different (means it will have contain word) each time i run the script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;1598&amp;nbsp; data _NULL_;&lt;BR /&gt;1599&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set sashelp.vcolumn end=eof;&lt;BR /&gt;1600&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where libname="Patch" and memname="WINDOWS_SERVERS";&lt;BR /&gt;1601&lt;BR /&gt;1602&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _N_=1 then do;&lt;BR /&gt;1603&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call execute('data Patch.Windows_Servers1; set Patch.Windows_Servers; rename');&lt;BR /&gt;1604&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;BR /&gt;1605&lt;BR /&gt;1606&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call execute(cats(NAME,'=',scan(NAME,1,"_")));&lt;BR /&gt;1607&lt;BR /&gt;1608&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if eof then do;&lt;BR /&gt;1609&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call execute('; run;');&lt;BR /&gt;1610&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;BR /&gt;1611&amp;nbsp; run;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 0 observations read from the data set SASHELP.VCOLUMN.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE (libname='Patch') and (memname='WINDOWS_SERVERS');&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3.67 seconds&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3.13 seconds&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vcolumn.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/19234i077F3A05CD689B7A/image-size/large?v=v2&amp;amp;px=999" role="button" title="vcolumn.jpg" alt="vcolumn.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Mar 2018 16:42:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-update-dynamically-created-variable-names/m-p/446252#M111940</guid>
      <dc:creator>radha009</dc:creator>
      <dc:date>2018-03-16T16:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to update dynamically created variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-update-dynamically-created-variable-names/m-p/446256#M111944</link>
      <description>&lt;P&gt;Libname and memname columns have uppercase values. Try&lt;/P&gt;
&lt;P&gt;where libname="PATCH" and memname="WINDOWS_SERVERS";&lt;/P&gt;</description>
      <pubDate>Fri, 16 Mar 2018 16:52:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-update-dynamically-created-variable-names/m-p/446256#M111944</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2018-03-16T16:52:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to update dynamically created variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-update-dynamically-created-variable-names/m-p/446259#M111947</link>
      <description>Nice it worked. how Can i rename only for couple of columns in table windows_servers</description>
      <pubDate>Fri, 16 Mar 2018 17:00:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-update-dynamically-created-variable-names/m-p/446259#M111947</guid>
      <dc:creator>radha009</dc:creator>
      <dc:date>2018-03-16T17:00:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to update dynamically created variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-update-dynamically-created-variable-names/m-p/453563#M114631</link>
      <description>&lt;P&gt;The variable names are changing as per the above code when the variable is SQL_test_TXT4324324 to SQL. But, I have the two variables with same starting name as SQL_test_TXT4324324&amp;nbsp; and SQL_test2_TXT432677. Can you help me how to rename similar start name variables.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 14:16:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-update-dynamically-created-variable-names/m-p/453563#M114631</guid>
      <dc:creator>radha009</dc:creator>
      <dc:date>2018-04-12T14:16:47Z</dc:date>
    </item>
  </channel>
</rss>

