<?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: Rename variables with the same suffix in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429510#M281497</link>
    <description>&lt;P&gt;It sounds like you are creating a headache instead of solving a problem.&amp;nbsp; Your current variable names are fine.&amp;nbsp; If you encounter (in the future) names like DATE1 and DATE2, how will you know which date refers to which variable?&amp;nbsp; At a minimum, don't rename them.&amp;nbsp; Copy them to DATE1 and DATE2, which you can use for sorting purposes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you really intend to append a bunch of data sets that contain different sets of variables?&amp;nbsp; I'm not sure you appreciate what that result would look like.&amp;nbsp; If you spell out where you are headed (if you succeed in this endeavor), you might be able to get some suggestions about ways to obtain your final objective.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At any rate, your current macro can probably do the job with minor modification.&amp;nbsp; Do you understand how it works, or is it code that was given to you without explanation?&lt;/P&gt;</description>
    <pubDate>Mon, 22 Jan 2018 00:17:40 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2018-01-22T00:17:40Z</dc:date>
    <item>
      <title>Rename variables with the same suffix</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429496#M281493</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using a macro to:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;1) &amp;nbsp;read through all the datasets which are in my external &amp;nbsp;library.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;2) pick only the ID and dates variables from one dataset at a time&lt;/P&gt;
&lt;P&gt;Some datasets have 1 date variable , others have 2. All the date variables have the same structure datanameDAT, datanameDAT2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the last step of my macro I want to rename the datanameDAT, datanameDAT2 to date1 and date2.&lt;/P&gt;
&lt;P&gt;The issue I am running into is that each dataset has a different prefix. Only the DAT suffix matches.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not able to rename the variables inside&amp;nbsp;the &amp;nbsp;macro.&lt;/P&gt;
&lt;P&gt;I also want to set all the external datasets into one dataset&amp;nbsp; by appending them after the steps in the macro, using the ID and the new date1 and date2 variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt; data have&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp; set &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;ext.have&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp; keep &amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;keepvar.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;data have&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;2&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp; set &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;have1&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp; how do I rename the variables haveDAT, haveDAT2 to date1, date2 in this step. When the macro runs it goes&amp;nbsp; through&amp;nbsp;all the datasets in the external library so I don't know the dataset it is working on.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;data final;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;set have2;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;I want to append all the datasets into one as they get processed by the macro.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Any suggestions?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks.&lt;/P&gt;
&lt;P&gt;KC&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jan 2018 22:23:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429496#M281493</guid>
      <dc:creator>Kc2</dc:creator>
      <dc:date>2018-01-21T22:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: Rename variables with the same suffix</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429502#M281494</link>
      <description>&lt;P&gt;Here is one way:&lt;/P&gt;
&lt;PRE&gt;data have;
  input havedat havedat2;
  cards;
1 2
;

data _null_;
  set have (obs=1) indsname=ds;
  call execute('data need;set have; rename ');
  call execute(catt(scan(ds,2,'.'),'dat=date1;'));
  call execute('rename ');
  call execute(catt(scan(ds,2,'.'),'dat2=date2;'));
  call execute('run;');
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jan 2018 23:07:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429502#M281494</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-01-21T23:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: Rename variables with the same suffix</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429505#M281495</link>
      <description>&lt;P&gt;Hello Art,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you for your response but it is not working. I get an error message stating the variables cannot be found. The piece of code you shared assumes that the variables have&amp;nbsp;the same&amp;nbsp; prefix as the entry dataset but I have some special cases:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a dataset named substance, and it has the variables&amp;nbsp; ID, DRUGDAT, SMOKDAT&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a dataset named endurance, and it has the variables ID,&amp;nbsp; ENDFDAT, ENDLDAT&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it possible to pick from the list of variables available only those which end in DAT and rename those?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you ,&lt;/P&gt;
&lt;P&gt;KC.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jan 2018 23:40:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429505#M281495</guid>
      <dc:creator>Kc2</dc:creator>
      <dc:date>2018-01-21T23:40:25Z</dc:date>
    </item>
    <item>
      <title>Re: Rename variables with the same suffix</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429510#M281497</link>
      <description>&lt;P&gt;It sounds like you are creating a headache instead of solving a problem.&amp;nbsp; Your current variable names are fine.&amp;nbsp; If you encounter (in the future) names like DATE1 and DATE2, how will you know which date refers to which variable?&amp;nbsp; At a minimum, don't rename them.&amp;nbsp; Copy them to DATE1 and DATE2, which you can use for sorting purposes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you really intend to append a bunch of data sets that contain different sets of variables?&amp;nbsp; I'm not sure you appreciate what that result would look like.&amp;nbsp; If you spell out where you are headed (if you succeed in this endeavor), you might be able to get some suggestions about ways to obtain your final objective.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At any rate, your current macro can probably do the job with minor modification.&amp;nbsp; Do you understand how it works, or is it code that was given to you without explanation?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 00:17:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429510#M281497</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-01-22T00:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: Rename variables with the same suffix</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429517#M281498</link>
      <description>&lt;P&gt;Yes I do understand the macro code I am using.&lt;/P&gt;
&lt;P&gt;I have around 25 datasets in my external library. These will increase to a&amp;nbsp;few more. I don't want to have to update my program each time a new dataset is added.&lt;/P&gt;
&lt;P&gt;In the first step&amp;nbsp;of the macro, using proc sql I create a table DATLST that&amp;nbsp;lists the datasets and the variables from dictionary.columns, Since I only want the IDs and the date I specify a where condition where name&amp;nbsp; in "ID" or name like "%DAT " .&lt;/P&gt;
&lt;P&gt;Then with another proc sql using count I count the number of memname to get the number of dataset and I assign them to a macro variable using into:.TOTCNT&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do a loop from 1 to totcnt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;first I grab from DATLST the memane at positon i&lt;/P&gt;
&lt;P&gt;by using a data _null_ statement with a call symput&amp;nbsp; to assign the memname to a macro variable&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then in a second data step I use the macro variable to call from &amp;nbsp;the external directory the dataset = to memname and do some processing.&lt;/P&gt;
&lt;P&gt;Because the number of datasets is not fixed I am trying to automate the program so I don't have to manually to the changes when they happen.&lt;/P&gt;
&lt;P&gt;Right now I am able to append all my datasets into one large one. The issue is that the date variable are different&amp;nbsp; and thus I cannot do the sorting&amp;nbsp;by date .&lt;/P&gt;
&lt;P&gt;If I can rename them dat variable then I can sort the large datasets by ID and dates and continue the processing I need.&lt;/P&gt;
&lt;P&gt;In&amp;nbsp; a data step . I know that I can specify each dataset and do the renaming in a simple way. I don't want to have to do it manually for each dataset&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 01:06:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429517#M281498</guid>
      <dc:creator>Kc2</dc:creator>
      <dc:date>2018-01-22T01:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: Rename variables with the same suffix</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429526#M281499</link>
      <description>&lt;P&gt;OK, let's back it up to the point where you extract from dictionary.columns.&amp;nbsp; If I understand correctly, you now have a SAS data set with MEMNAME and NAME, and a limited number of observations representing a limited number of variables (ID, and any date variables).&amp;nbsp; This might not be the fastest way, but it might be reasonably simple and effective.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data=extract;&lt;/P&gt;
&lt;P&gt;by memname;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;set extract (where=(upcase(name) ne 'ID'));&lt;/P&gt;
&lt;P&gt;by memname;&lt;/P&gt;
&lt;P&gt;if first.memname then do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;datecount=1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;call execute ('data ' || memname || '; set ' || memname || ';');&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;else datecount + 1;&lt;/P&gt;
&lt;P&gt;call execute ('rename ' || name || '= date' || put(datecount, 1.) || ';');&lt;/P&gt;
&lt;P&gt;if last.memname then call execute('run;');&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This generates a series of DATA steps, one for each in your extract.&amp;nbsp; It renames every date variable selected by the extract.&amp;nbsp; It keeps all variables originally in the data set, however.&amp;nbsp; Is this at least moving in the right direction?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 01:38:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429526#M281499</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-01-22T01:38:55Z</dc:date>
    </item>
    <item>
      <title>Re: Rename variables with the same suffix</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429534#M281500</link>
      <description>&lt;P&gt;I tried the solution you suggest before posting my question on this forum. it does not work.&amp;nbsp;If you change the variable name&amp;nbsp; in the first step , then when you go&amp;nbsp;to call the actual data from the external library the variables which are renamed cannot be found.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is my code:&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;create&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;table&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; DATLST &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;as&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;select&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; memname,name&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; dictionary.columns&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; upcase(&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;libname&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;)=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"EXT"&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;and&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; (upcase(name)&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;in&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"ID"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;) or upcase(name) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;like&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"%DAT"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;) );&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;Proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;sort&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= datlst ; &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; memname name ; &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; loop();&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%local&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; TOTCNT rpt dsin keepvar;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql noprint;&lt;/P&gt;
&lt;P&gt;select count(memname)&lt;/P&gt;
&lt;P&gt;into :TOTCNT&lt;/P&gt;
&lt;P&gt;from DATLST;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%put&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; datasets= &amp;amp;TOTCNT;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; rpt=1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%do&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%while&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; (&amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;rpt.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;lt;= &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT color="#008000" face="Courier New" size="2"&gt;/*&amp;amp;TOTCNT.*/&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt; set DATLST (firstobs=&amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;rpt.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; obs=&amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;rpt.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;); &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt; call symput(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"dsin"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,strip(memname));&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data ds0;&lt;/P&gt;
&lt;P&gt;set DATLST;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt; where memname=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"&amp;amp;dsin."&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc transpose data=ds0 out=tr_ds0(drop=_name_ _label_);&lt;/P&gt;
&lt;P&gt;by memname ;&lt;/P&gt;
&lt;P&gt;var name;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql noprint ;&lt;/P&gt;
&lt;P&gt;select count(distinct name )into :varnum&lt;/P&gt;
&lt;P&gt;from ds0 ;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%put&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; varnum = &amp;amp;varnum;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data tr_ds ;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt; length keepvar_ $&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;600&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;set tr_ds0 ;&lt;/P&gt;
&lt;P&gt;retain keepvar_;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%do&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; i=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%to&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;varnum.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt; keepvar_=catx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;" "&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ,keepvar_,col&amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;i.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt; call symput(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"keepvar"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,keepvar_);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt; i+&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%end&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%put&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; vars to keep= &amp;amp;keepvar;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt; data ds1&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt; length fromdat $&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;200&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt; set &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;idraw.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;dsin.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt; fromdat=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"&amp;amp;dsin."&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt; keep fromdat &amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;keepvar.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/*At this stage my ds1 dataset has 4 variables: ID, FROMDAT, XXXDAT, XXXDAT. I don't know what the XXX is and I want to do the renaming automatically.SAS does allow to manipulate variable who have the same prefix with the colon e.g SAME:.&amp;nbsp; I am wondering if there is a way to do it with variables with&amp;nbsp;the same suffix.&amp;nbsp;*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data ds2;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt; set ds1&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="2"&gt;/*renaming DAT variables*/&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; rpt=&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%eval&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;(&amp;amp;rpt.+1);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%put&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; rpt= &amp;amp;rpt.;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%end&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;loop&lt;/I&gt;&lt;/STRONG&gt;()&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 02:38:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429534#M281500</guid>
      <dc:creator>Kc2</dc:creator>
      <dc:date>2018-01-22T02:38:21Z</dc:date>
    </item>
    <item>
      <title>Re: Rename variables with the same suffix</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429536#M281501</link>
      <description>&lt;P&gt;Using array has solved the problem.&lt;/P&gt;
&lt;P&gt;data ds2 ;&lt;/P&gt;
&lt;P&gt;set ds1 ;&lt;/P&gt;
&lt;P&gt;array vars[*] _numeric_;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;date1 = vars[&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;];&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;date2 = vars[&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;3&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;];&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;keep subject date1 date2 ;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt; format date1 date2 &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 15:57:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429536#M281501</guid>
      <dc:creator>Kc2</dc:creator>
      <dc:date>2018-01-22T15:57:45Z</dc:date>
    </item>
    <item>
      <title>Re: Rename variables with the same suffix</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429540#M281502</link>
      <description>&lt;P&gt;I am not sure I understand what your goal is.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you numbering the new "DATEnn" variables restarting from 1 for each separate input dataset? Or do you want to number them as one long sequence?&lt;/P&gt;
&lt;P&gt;It is simple to get the list of variables and generate a new name.&amp;nbsp; Here is example that gives each one a distinct name.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
  create table DATLST as
    select libname,memname,varnum,name
    from dictionary.columns
    where libname="EXT"
      and (upcase(name) = "ID" or upcase(name) like '%DAT')
    order by 1,2,3
  ;
quit;

data datlst ;
  set datlst ;
  by libname memname ;
  length newname $8 ;
  if upcase(name) ne 'ID' then do;
     n+1;
     newname=cats('DATE',n);
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now what are you going to do with this list?&lt;/P&gt;
&lt;P&gt;Are you just trying to rename the "DAT" variables?&lt;/P&gt;
&lt;P&gt;Are you trying to&amp;nbsp;merge a group of datasets by ID and keep only the "DAT" variables?&lt;/P&gt;
&lt;P&gt;You could generate code to do that easily from the dataset above.&amp;nbsp; You could even generate code to assign labels to the new variables to indicate where they came from.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename code temp ;
data _null_;
  file code lrecl=80 ;
  set datlst end=eof;
  by libname memname ;
  if _n_ = 1 then put 'merge' ;
  if first.memname then put @3 libname +(-1) '.' memname '(' @ ;
  put 'keep=' name @ ;
  if upcase(name) ne 'ID' then put 'rename=(' name '=' newname ') ' @ ;
  if last.memname then put ')';
  if eof then put ';' ;
run;

filename labels temp ;
data _null_;
  file labels ;
  set datlst end=eof;
  where upcase(name) ne 'ID' ;
  if _n_ = 1 then put 'label' ;
  put @3 newname "='" libname memname name "'" ;
  if eof then put ';' ;
run;

data all ;
%include code / source2 ;
  by id;
%include labels / source2 ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Let's make up a little test situation to see if that code generation works. First let's make two copies of SASHELP.CLASS and rename NAME as ID.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class1 class2; set sashelp.class ; rename name=id; run ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then let's make an example DATLST dataset and see if the code generation works.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data datlst ;
  length libname $8 memname $32 varnum 8 name $32 newname $8 ;
  input libname -- newname ;
cards;
work class1 1 id .
work class1 2 height ht
work class2 1 id .
work class2 2 weight wt
work class2 5 sex gender
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results&lt;/P&gt;
&lt;PRE&gt;148  data all ;
149  %include code / source2 ;
NOTE: %INCLUDE (level 1) file CODE is file
      /hpc/grid/sas-scratcht/SAS_workE46700072DF7/#LN00023.
150 +merge
151 +  work.class1 (keep=id keep=height rename=(height =ht ) )
152 +  work.class2 (keep=id keep=weight rename=(weight =wt ) keep=sex rename=(sex =
153 +gender ) )
154 +;
NOTE: %INCLUDE (level 1) ending.
155    by id;
156  %include labels / source2 ;
NOTE: %INCLUDE (level 1) file LABELS is file
      /hpc/grid/sas-scratcht/SAS_workE46700072DF7/#LN00024.
157 +label
158 +  ht ='work class1 height '
159 +  wt ='work class2 weight '
160 +  gender ='work class2 sex '
161 +;
NOTE: %INCLUDE (level 1) ending.
162  run;

NOTE: There were 19 observations read from the data set WORK.CLASS1.
NOTE: There were 19 observations read from the data set WORK.CLASS2.
NOTE: The data set WORK.ALL has 19 observations and 4 variables.&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 04:57:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429540#M281502</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-01-22T04:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: Rename variables with the same suffix</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429600#M281503</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/3443"&gt;@Kc2&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Using array has solved the problem.&lt;/P&gt;
&lt;P&gt;data ds2 ;&lt;/P&gt;
&lt;P&gt;set ds1 ;&lt;/P&gt;
&lt;P&gt;array vars[*] _numeric_;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;date1 = vars[&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;];&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;date2 = vars[&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;3&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;];&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;keep subject edate1 edate2 ;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt; format svdate1 svdate2 &lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Even though you have marked this solution as correct, it can't possibly be correct because there is no renaming of variables to add the same suffix here. Thus, I am asking you to explain how this is the proper solution; or un-mark it as correct.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using PROC SQL, it is relatively easy to rename variables to have the same suffix.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;UNTESTED CODE&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data cars;
	set sashelp.cars;
run;
proc contents data=cars noprint out=_cont_;
run;
proc sql noprint;
	select distinct cats(name,'=',name,'_mysuffix') into :renames separated by ' ' from _cont_ where type=1;
quit;
%put &amp;amp;=renames;
proc datasets library=work;
	modify cars;
	rename &amp;amp;renames;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 13:30:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429600#M281503</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-01-22T13:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: Rename variables with the same suffix</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429652#M281504</link>
      <description>&lt;P&gt;It work because I know that in my dataset I have 3 numeric variables. the first one is the ID the second and third ones are the dates.&lt;/P&gt;
&lt;P&gt;Because the date variable name are not consistent instead of renaming the variable I am assigning the names I want , date1 and date2 , to the variables in located in position 2 and 3 of my array. it solved my problem.&lt;/P&gt;
&lt;P&gt;I am not renaming them using the rename function but doing it by assigning them through an array.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 15:29:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429652#M281504</guid>
      <dc:creator>Kc2</dc:creator>
      <dc:date>2018-01-22T15:29:25Z</dc:date>
    </item>
    <item>
      <title>Re: Rename variables with the same suffix</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429655#M281505</link>
      <description>&lt;P&gt;Although this is the first time you mentioned the fact that the second and third numeric variables are ALWAYS the two dates you're interested in, your code (as posted) won't work because:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You create date1 and date2, but don't keep them (you are keeping subject, edate1 and edate2)&lt;/P&gt;
&lt;P&gt;You format svdate1 and svdate2, but never mention them in your code. Do those two variables even exist?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 15:44:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429655#M281505</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-01-22T15:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: Rename variables with the same suffix</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429656#M281506</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/3443"&gt;@Kc2&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;It work because I know that in my dataset I have 3 numeric variables. the first one is the ID the second and third ones are the dates.&lt;/P&gt;
&lt;P&gt;Because the date variable name are not consistent instead of renaming the variable I am assigning the names I want , date1 and date2 , to the variables in located in position 2 and 3 of my array. it solved my problem.&lt;/P&gt;
&lt;P&gt;I am not renaming them using the rename function but doing it by assigning them through an array.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You still need to UNMARK your solution as the correct answer, because it has nothing to do with renaming variables now, which was the original question.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 15:50:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429656#M281506</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-01-22T15:50:56Z</dc:date>
    </item>
    <item>
      <title>Re: Rename variables with the same suffix</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429658#M281507</link>
      <description>&lt;P&gt;I updated the code I posted, the one which solved my problem.&lt;/P&gt;
&lt;P&gt;Thank you for response.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 15:59:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429658#M281507</guid>
      <dc:creator>Kc2</dc:creator>
      <dc:date>2018-01-22T15:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: Rename variables with the same suffix</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429660#M281508</link>
      <description>&lt;P&gt;Thank you everyone for your help. I have solved my problem by reassigning my variables instead of renaming them.&lt;/P&gt;
&lt;P&gt;KC&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 16:01:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-variables-with-the-same-suffix/m-p/429660#M281508</guid>
      <dc:creator>Kc2</dc:creator>
      <dc:date>2018-01-22T16:01:24Z</dc:date>
    </item>
  </channel>
</rss>

