<?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 delete the suffix of variable names in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-delete-the-suffix-of-variable-names/m-p/510358#M1935</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input s_1_14 s_2_14 s_149_14 s_144;
cards;
1 2 3 4
;

proc sql;
select catx('=',name,prxchange('s/\_14$//',-1,strip(name))) as renamex into: renam separated by ' ' from dictionary.columns where libname='WORK' and memname='HAVE' and prxmatch('m/\_14$/',strip(name));
quit;

data want;
set have;
rename &amp;amp;renam;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 05 Nov 2018 11:19:09 GMT</pubDate>
    <dc:creator>Jagadishkatam</dc:creator>
    <dc:date>2018-11-05T11:19:09Z</dc:date>
    <item>
      <title>How to delete the suffix of variable names</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-delete-the-suffix-of-variable-names/m-p/510353#M1934</link>
      <description>&lt;P&gt;I am working with a dataset containing approximately 200 variables&amp;nbsp;and almost&amp;nbsp;all of them has a name like s_1_14, s_2_14, ... s_149_14, and obviously the variable names don't have the same length.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to delete the "_14"-part of all the variable names, but I can't seem to figure out how to do it. I have tried the code from this post: &lt;A href="https://communities.sas.com/t5/General-SAS-Programming/Removing-a-suffix-from-a-variable-name/m-p/278746#M38598" target="_self"&gt;Removing a suffix from a variable name&lt;/A&gt;&amp;nbsp;, but since some of my variables are named s_144_14, it doesn't quite do the job. I really hope some of you how this is done other than renaming each variable manually &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Nov 2018 10:21:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-delete-the-suffix-of-variable-names/m-p/510353#M1934</guid>
      <dc:creator>BeeB</dc:creator>
      <dc:date>2018-11-05T10:21:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete the suffix of variable names</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-delete-the-suffix-of-variable-names/m-p/510358#M1935</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input s_1_14 s_2_14 s_149_14 s_144;
cards;
1 2 3 4
;

proc sql;
select catx('=',name,prxchange('s/\_14$//',-1,strip(name))) as renamex into: renam separated by ' ' from dictionary.columns where libname='WORK' and memname='HAVE' and prxmatch('m/\_14$/',strip(name));
quit;

data want;
set have;
rename &amp;amp;renam;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Nov 2018 11:19:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-delete-the-suffix-of-variable-names/m-p/510358#M1935</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2018-11-05T11:19:09Z</dc:date>
    </item>
  </channel>
</rss>

