<?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: Remove variables in a data set that does not contain a pattern and rename variables in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Remove-variables-in-a-data-set-that-does-not-contain-a-pattern/m-p/890062#M39580</link>
    <description>Thank you kurt_Bremser. Is there an example or something like that to inspire to? &lt;BR /&gt;</description>
    <pubDate>Sat, 19 Aug 2023 18:41:49 GMT</pubDate>
    <dc:creator>NewUsrStat</dc:creator>
    <dc:date>2023-08-19T18:41:49Z</dc:date>
    <item>
      <title>Remove variables in a data set that does not contain a pattern and rename variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-variables-in-a-data-set-that-does-not-contain-a-pattern/m-p/890055#M39578</link>
      <description>&lt;P&gt;Is there a way to remove columns that does not end with "_22" from a data set? Moreover, is there a way to remove "_22" suffix from column names from another data set?&lt;/P&gt;
&lt;P&gt;Thank you in advance&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Aug 2023 15:28:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-variables-in-a-data-set-that-does-not-contain-a-pattern/m-p/890055#M39578</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2023-08-19T15:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: Remove variables in a data set that does not contain a pattern and rename variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-variables-in-a-data-set-that-does-not-contain-a-pattern/m-p/890059#M39579</link>
      <description>&lt;P&gt;In PROC SQL, you can retriev variable names from DICTIONARY.COLUMNS. With SELECT INTO, you can create macro variables which contain the necessary lists for DROP and RENAME statements used in PROC DATASETS.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Aug 2023 16:52:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-variables-in-a-data-set-that-does-not-contain-a-pattern/m-p/890059#M39579</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-08-19T16:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: Remove variables in a data set that does not contain a pattern and rename variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-variables-in-a-data-set-that-does-not-contain-a-pattern/m-p/890062#M39580</link>
      <description>Thank you kurt_Bremser. Is there an example or something like that to inspire to? &lt;BR /&gt;</description>
      <pubDate>Sat, 19 Aug 2023 18:41:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-variables-in-a-data-set-that-does-not-contain-a-pattern/m-p/890062#M39580</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2023-08-19T18:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: Remove variables in a data set that does not contain a pattern and rename variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-variables-in-a-data-set-that-does-not-contain-a-pattern/m-p/890066#M39582</link>
      <description>&lt;P&gt;What ways do you know (if any) to get the names of variables in your data set?&lt;/P&gt;</description>
      <pubDate>Sat, 19 Aug 2023 19:44:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-variables-in-a-data-set-that-does-not-contain-a-pattern/m-p/890066#M39582</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2023-08-19T19:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: Remove variables in a data set that does not contain a pattern and rename variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-variables-in-a-data-set-that-does-not-contain-a-pattern/m-p/890069#M39583</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select catx("=",name,substr(name,1,length(name)-3)), substr(name,1,length(name)-3)&lt;BR /&gt;into :renamestr separated by " ", dropstr separated by " "
from dictionary.columns
where libname = "WORK" and memname = "HAVE" and substr(name,length(name)-2) = "_22";
quit;

data want;
set have;
drop &amp;amp;dropstr.;
rename &amp;amp;renamestr.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Since you want to remove variables, PROC DATASETS can't do it, a DATA step is needed. My bad.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Aug 2023 20:25:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-variables-in-a-data-set-that-does-not-contain-a-pattern/m-p/890069#M39583</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-08-19T20:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: Remove variables in a data set that does not contain a pattern and rename variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-variables-in-a-data-set-that-does-not-contain-a-pattern/m-p/890075#M39584</link>
      <description>&lt;P&gt;In my occasionally humble opinion, the question is why to do you have variables with names you don't want in the first place. Especially something ending in _22. That almost implies that you have 21 other names that are acceptable (ending in _1&amp;nbsp; _2 _3 ... _21).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you have data set names you don't like and want different names then Proc Datasets will let you rename the variables in place.&lt;/P&gt;
&lt;PRE&gt;Proc datasets library=Somelib;
   modify adataset;
      rename var_22 = var
             thatvar_22 = thatvar
       ;
run;
quit;&lt;/PRE&gt;
&lt;P&gt;The example code will modify the dataset named Adataset in the library named Somelib by renaming tow variables.&lt;/P&gt;
&lt;P&gt;Note this procedure uses a QUIT statement to end the procedure.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Aug 2023 23:03:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-variables-in-a-data-set-that-does-not-contain-a-pattern/m-p/890075#M39584</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-08-19T23:03:38Z</dc:date>
    </item>
  </channel>
</rss>

