<?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: Keep names of multiples columns After a specific caracter in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Rename-multiples-columns/m-p/890385#M351833</link>
    <description>&lt;P&gt;Well then, we seem to all be saying the same thing to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/448432"&gt;@Idi&lt;/a&gt;&amp;nbsp;. So,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/448432"&gt;@Idi&lt;/a&gt;&amp;nbsp;please show us PROC CONTENTS output for this data set.&lt;/P&gt;</description>
    <pubDate>Tue, 22 Aug 2023 13:45:15 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2023-08-22T13:45:15Z</dc:date>
    <item>
      <title>Rename multiples columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-multiples-columns/m-p/890350#M351826</link>
      <description>TesSAS&lt;BR /&gt;&lt;BR /&gt;I have multiples columns starts with td_tou_ha.t_sadi , td_tou_ha.t_haba&lt;BR /&gt;Etc.... All the columns start with td_tou_ha.&lt;BR /&gt;&lt;BR /&gt;I want to keep only names After the point (.) For example : t_sadi , t_haba etc.&lt;BR /&gt;Using SAS studio. Macro or SQL any help please ?&lt;BR /&gt;&lt;BR /&gt;Thanks you so for your help.&lt;BR /&gt;&lt;BR /&gt;I try rename fonction but its to much i want to do with macro but never use or.t</description>
      <pubDate>Tue, 22 Aug 2023 10:28:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-multiples-columns/m-p/890350#M351826</guid>
      <dc:creator>Idi</dc:creator>
      <dc:date>2023-08-22T10:28:45Z</dc:date>
    </item>
    <item>
      <title>Re: Rename multiples columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-multiples-columns/m-p/890355#M351827</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I have multiples columns starts with td_tou_ha.t_sadi , td_tou_ha.t_haba&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;It's not clear to me what you are talking about. Column names cannot have a dot in them. Unless you are referencing them in SQL, in which case the table is referred to as td_tou_ha and the column name already is what you want it to be t_sadi. Can you please explain in more detail what it is you are talking about? It would also help for you to show us a portion of the SAS data set you are working with.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 10:42:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-multiples-columns/m-p/890355#M351827</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-08-22T10:42:06Z</dc:date>
    </item>
    <item>
      <title>Keep names of multiples columns After a specific caracter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-multiples-columns/m-p/890359#M351828</link>
      <description>Hi ,&lt;BR /&gt;&lt;BR /&gt;I want to change multiple column : All the columns start with : td_ha.&lt;BR /&gt;After the . I have the Real name of the columns like : t_test&lt;BR /&gt;Td_ha.t_test = i want only t_test&lt;BR /&gt;I have 156 columns start with : td_ha. I just want to be After the point.&lt;BR /&gt;Thank you.</description>
      <pubDate>Tue, 22 Aug 2023 10:55:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-multiples-columns/m-p/890359#M351828</guid>
      <dc:creator>Idi</dc:creator>
      <dc:date>2023-08-22T10:55:11Z</dc:date>
    </item>
    <item>
      <title>Re: Keep names of multiples columns After a specific caracter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-multiples-columns/m-p/890360#M351829</link>
      <description>&lt;P&gt;You have asked a similar question earlier. I provided a reply asking for more information. Please answer at your other thread&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Enterprise-Guide/Rename-multiples-columns/td-p/890350/jump-to/first-unread-message" target="_blank"&gt;https://communities.sas.com/t5/SAS-Enterprise-Guide/Rename-multiples-columns/td-p/890350/jump-to/first-unread-message&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please do not ask the same question more than once. Let's keep all discussion of this issue in that one thread.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 11:05:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-multiples-columns/m-p/890360#M351829</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-08-22T11:05:38Z</dc:date>
    </item>
    <item>
      <title>Re: Keep names of multiples columns After a specific caracter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-multiples-columns/m-p/890361#M351830</link>
      <description>&lt;P&gt;Lets see if we can get some clarity. In most circumstances . is not part of a variable name. So are you claiming that your data set contains a .&amp;nbsp; as part of the variable name? If so, while possible the syntax gets a bit uglier as it means you have created variables with the system option VALIDVARNAME=any. Part of a better solution may involve changing options and bringing data into SAS again without the .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Run proc contents on your data set and show us the results with the variable names and properties to make sure we know what your actual variable names may be.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The basic tool is a RENAME statement, either in a data step or using Proc Contents. But we want to see actual names to make sure what we understand what you have.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 11:06:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-multiples-columns/m-p/890361#M351830</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-08-22T11:06:53Z</dc:date>
    </item>
    <item>
      <title>Re: Keep names of multiples columns After a specific caracter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-multiples-columns/m-p/890363#M351831</link>
      <description>Thank you</description>
      <pubDate>Tue, 22 Aug 2023 11:19:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-multiples-columns/m-p/890363#M351831</guid>
      <dc:creator>Idi</dc:creator>
      <dc:date>2023-08-22T11:19:24Z</dc:date>
    </item>
    <item>
      <title>Re: Keep names of multiples columns After a specific caracter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-multiples-columns/m-p/890384#M351832</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;You have asked a similar question earlier. I provided a reply asking for more information. Please answer at your other thread&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Enterprise-Guide/Rename-multiples-columns/td-p/890350/jump-to/first-unread-message" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Enterprise-Guide/Rename-multiples-columns/td-p/890350/jump-to/first-unread-message&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please do not ask the same question more than once. Let's keep all discussion of this issue in that one thread.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You also asked the question on stackoverflow (&lt;A href="https://stackoverflow.com/questions/76947350/rename-multiples-columns-startswith-and-end-with-in-sas" target="_blank"&gt;https://stackoverflow.com/questions/76947350/rename-multiples-columns-startswith-and-end-with-in-sas&lt;/A&gt;&amp;nbsp;) and I responded with a question asking for your to run PROC CONTENTS to check the variable names.&amp;nbsp; It's fair to ask the same question on different sites (once per site).&amp;nbsp; When people respond with questions, you're more likely to get help if you respond in turn.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 13:43:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-multiples-columns/m-p/890384#M351832</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-08-22T13:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: Keep names of multiples columns After a specific caracter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-multiples-columns/m-p/890385#M351833</link>
      <description>&lt;P&gt;Well then, we seem to all be saying the same thing to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/448432"&gt;@Idi&lt;/a&gt;&amp;nbsp;. So,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/448432"&gt;@Idi&lt;/a&gt;&amp;nbsp;please show us PROC CONTENTS output for this data set.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 13:45:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-multiples-columns/m-p/890385#M351833</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-08-22T13:45:15Z</dc:date>
    </item>
    <item>
      <title>Re: Keep names of multiples columns After a specific caracter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-multiples-columns/m-p/890386#M351834</link>
      <description>&lt;P&gt;To change the name 'Td_ha.t_test'n to t_test you will need a RENAME statement&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;rename 'Td_ha.t_test'n = t_test;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or perhaps the RENAME= dataset option.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;set have (rename=( 'Td_ha.t_test'n = t_test));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To convert the string&amp;nbsp;&amp;nbsp;'Td_ha.t_test' to the string 't_test' you can use the SUBSTR() function.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;new_name = substr(name,7) ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If your input dataset is named HAVE you can get the list of names from it by using PROC CONTENTS.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents data=have out=contents noprint;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can then query that list of names and find the ones that start with that string so you can generate the old=new pairs needed for either the RENAME statement or the RENAME= dataset option.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
  select catx('=',nliteral(name),nliteral(substr(name,7)))
    into :renames separated by ' '
  from contents
  where upcase(name) eqt 'TD_HA.'
  ;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can then use that macro variable to generate the rename statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  rename &amp;amp;renames;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 14:38:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-multiples-columns/m-p/890386#M351834</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-08-22T14:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: Keep names of multiples columns After a specific caracter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-multiples-columns/m-p/890395#M351835</link>
      <description>&lt;P&gt;I combined your questions into one thread.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 14:37:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-multiples-columns/m-p/890395#M351835</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-08-22T14:37:50Z</dc:date>
    </item>
    <item>
      <title>Re: Keep names of multiples columns After a specific caracter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-multiples-columns/m-p/890396#M351836</link>
      <description>Thank you so much for your help.</description>
      <pubDate>Tue, 22 Aug 2023 14:47:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-multiples-columns/m-p/890396#M351836</guid>
      <dc:creator>Idi</dc:creator>
      <dc:date>2023-08-22T14:47:26Z</dc:date>
    </item>
  </channel>
</rss>

