<?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: Removing a part of column name in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Removing-a-part-of-column-name/m-p/309146#M312740</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/112091"&gt;@akhilesh_joshi﻿&lt;/a&gt;&amp;nbsp;Then&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15410"&gt;@data_null__﻿&lt;/a&gt;&amp;nbsp;solution is the correct solution. Use the function to extract the number and then filter on it using an IF statement.&lt;/P&gt;</description>
    <pubDate>Thu, 03 Nov 2016 20:54:12 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-11-03T20:54:12Z</dc:date>
    <item>
      <title>Removing a part of column name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-a-part-of-column-name/m-p/309109#M312731</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One of column names in table is in format xyz_1 to xyz_16. I am trying to include only columns xyz_6 to xyz_16 by using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;case when substr('columnname', 1, length(columnname)-1) &amp;lt;= 16 and substr('columnname', 1, length(columname)-1) =&amp;gt; 6&amp;nbsp;&lt;BR /&gt;then columnname end as columnname. But its not working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone point out what error I am making?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 18:24:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-a-part-of-column-name/m-p/309109#M312731</guid>
      <dc:creator>akhilesh_joshi</dc:creator>
      <dc:date>2016-11-03T18:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Removing a part of column name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-a-part-of-column-name/m-p/309111#M312732</link>
      <description>&lt;P&gt;why not just say&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;xyz6-xyz16&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Nov 2016 18:30:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-a-part-of-column-name/m-p/309111#M312732</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-11-03T18:30:58Z</dc:date>
    </item>
    <item>
      <title>Re: Removing a part of column name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-a-part-of-column-name/m-p/309120#M312733</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This column is in another table and I am trying to create a new table where in I want columns only from x_6 to x_16.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 19:03:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-a-part-of-column-name/m-p/309120#M312733</guid>
      <dc:creator>akhilesh_joshi</dc:creator>
      <dc:date>2016-11-03T19:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: Removing a part of column name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-a-part-of-column-name/m-p/309123#M312734</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data new;
&amp;nbsp;&amp;nbsp; set old(keep=xyz6-xyz16);
&amp;nbsp;&amp;nbsp; run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 19:08:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-a-part-of-column-name/m-p/309123#M312734</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-11-03T19:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: Removing a part of column name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-a-part-of-column-name/m-p/309129#M312735</link>
      <description>&lt;P&gt;The name of column is xyz and it has values xyz_1 to xyz_16.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 19:23:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-a-part-of-column-name/m-p/309129#M312735</guid>
      <dc:creator>akhilesh_joshi</dc:creator>
      <dc:date>2016-11-03T19:23:56Z</dc:date>
    </item>
    <item>
      <title>Re: Removing a part of column name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-a-part-of-column-name/m-p/309133#M312736</link>
      <description>&lt;P&gt;Extract the number using&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Input(Scan(column,-1,'_'),f12.);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Nov 2016 19:31:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-a-part-of-column-name/m-p/309133#M312736</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-11-03T19:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: Removing a part of column name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-a-part-of-column-name/m-p/309134#M312737</link>
      <description>&lt;P&gt;what do you mean by &lt;STRONG&gt;include&lt;/STRONG&gt; columns ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you mean KEEP on output ? &amp;nbsp;- if so then code: KEEP xyz_6 - xyz_16&lt;/P&gt;
&lt;P&gt;like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;KEEP xyz_6 - xyz_16;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 19:37:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-a-part-of-column-name/m-p/309134#M312737</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2016-11-03T19:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: Removing a part of column name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-a-part-of-column-name/m-p/309136#M312738</link>
      <description>&lt;P&gt;Provide examples of the actual data involved. It seems that the story changes each time you get a suggestion. Not a description actual rows of data pasted as text.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 19:50:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-a-part-of-column-name/m-p/309136#M312738</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-11-03T19:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: Removing a part of column name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-a-part-of-column-name/m-p/309137#M312739</link>
      <description>&lt;P&gt;It was my mistake. I used the word column instead of row. My column name is xyz. and it has values xyz_1 to xyz_16. so I want rows which only have values xyz_6 to xyz_16.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 20:00:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-a-part-of-column-name/m-p/309137#M312739</guid>
      <dc:creator>akhilesh_joshi</dc:creator>
      <dc:date>2016-11-03T20:00:13Z</dc:date>
    </item>
    <item>
      <title>Re: Removing a part of column name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-a-part-of-column-name/m-p/309146#M312740</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/112091"&gt;@akhilesh_joshi﻿&lt;/a&gt;&amp;nbsp;Then&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15410"&gt;@data_null__﻿&lt;/a&gt;&amp;nbsp;solution is the correct solution. Use the function to extract the number and then filter on it using an IF statement.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 20:54:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-a-part-of-column-name/m-p/309146#M312740</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-11-03T20:54:12Z</dc:date>
    </item>
    <item>
      <title>Re: Removing a part of column name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-a-part-of-column-name/m-p/309554#M312741</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/112091"&gt;@akhilesh_joshi﻿&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;That's why it's so important that you post sample data and then explain us how the desired result needs to look like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here you go:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  length xyz $32;
  do xyz='xyz_1','xYz_2','xyz_16','xyz_17','abc_1','xyz','xyz_1_abc','xyz_abc_1','xyz';
    output;
  end;
run;

data want;
  set have;
  if
    upcase(scan(xyz,1,'_'))='XYZ' 
    and ( 1 &amp;lt;= input(substrn(xyz,findc(xyz,'_')+1),?? f12.) &amp;lt;= 16 );
    ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Nov 2016 01:29:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-a-part-of-column-name/m-p/309554#M312741</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2016-11-06T01:29:19Z</dc:date>
    </item>
  </channel>
</rss>

