<?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: Dele columns by criteria related to its names in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Dele-columns-by-criteria-related-to-its-names/m-p/772708#M245382</link>
    <description>&lt;PRE&gt;Data want;
   set have (keep=id x1-x3 w1-w3);
run;&lt;/PRE&gt;
&lt;P&gt;Or were you asking because you have no idea what the actual names of the variables involved will be?&lt;/P&gt;</description>
    <pubDate>Thu, 07 Oct 2021 12:47:42 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-10-07T12:47:42Z</dc:date>
    <item>
      <title>Dele columns by criteria related to its names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dele-columns-by-criteria-related-to-its-names/m-p/772632#M245349</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I have a data set with many columns .&lt;/P&gt;
&lt;P&gt;I want to remove columns by the following rule:&lt;/P&gt;
&lt;P&gt;IF name of the variables end with a number greater then 3 then need to delete this column.&lt;/P&gt;
&lt;P&gt;So, in this example I will remove columns X4,X5, W4,W5&lt;/P&gt;
&lt;P&gt;What is the way to do it please?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data tbl;
input ID x1 x2 x3 x4 x5 w1 w2 w3 w4 w5 ;
cards;
1 10 20 30 40 50 11 12 13 14 15
2 20 30 40 50 60 12 13 14 15 16
;
Run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Oct 2021 06:31:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dele-columns-by-criteria-related-to-its-names/m-p/772632#M245349</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-10-07T06:31:10Z</dc:date>
    </item>
    <item>
      <title>Re: Dele columns by criteria related to its names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dele-columns-by-criteria-related-to-its-names/m-p/772636#M245353</link>
      <description>&lt;P&gt;Below one way how you could go about this.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data tbl;
  input ID x1 x2 x3 x4 x5 w1 w2 w3 w4 w5;
cards;
1 10 20 30 40 50 11 12 13 14 15
2 20 30 40 50 60 12 13 14 15 16
;

%let droplist=;
proc sql noprint;
  select 
    name into :droplist separated by ' '
  from dictionary.columns
  where 
    libname='WORK' 
    and memname='TBL' 
    and input(scan(name,-1,,'kd'),32.)&amp;gt;3
  ;
quit;

data tbl_new;
  set tbl;
  drop &amp;amp;droplist;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Oct 2021 07:01:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dele-columns-by-criteria-related-to-its-names/m-p/772636#M245353</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-10-07T07:01:25Z</dc:date>
    </item>
    <item>
      <title>Re: Dele columns by criteria related to its names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dele-columns-by-criteria-related-to-its-names/m-p/772638#M245355</link>
      <description>&lt;P&gt;Catch the opportunity and restructure to a more usable long layout:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data tbl;
input ID x1 x2 x3 x4 x5 w1 w2 w3 w4 w5 ;
cards;
1 10 20 30 40 50 11 12 13 14 15
2 20 30 40 50 60 12 13 14 15 16
;

data want;
set tbl;
array _x{*} x:;
array _w{*} w:;
do i = 1 to min(3,dim(_x));
  x = _x{i};
  w = _w{i};
  output;
end;
keep id i x w;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Oct 2021 07:14:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dele-columns-by-criteria-related-to-its-names/m-p/772638#M245355</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-10-07T07:14:58Z</dc:date>
    </item>
    <item>
      <title>Re: Dele columns by criteria related to its names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dele-columns-by-criteria-related-to-its-names/m-p/772708#M245382</link>
      <description>&lt;PRE&gt;Data want;
   set have (keep=id x1-x3 w1-w3);
run;&lt;/PRE&gt;
&lt;P&gt;Or were you asking because you have no idea what the actual names of the variables involved will be?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2021 12:47:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dele-columns-by-criteria-related-to-its-names/m-p/772708#M245382</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-10-07T12:47:42Z</dc:date>
    </item>
  </channel>
</rss>

