<?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 Can we apply filters on labels in a dataset ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Can-we-apply-filters-on-labels-in-a-dataset/m-p/259277#M50133</link>
    <description>&lt;P&gt;For instance I have my variables - Labels in the below fomat:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CELL_CALL_CNT_M1 - count of cell calls-April&lt;/P&gt;&lt;P&gt;CELL_CALL_CNT_M2 - count of cell calls-May&lt;/P&gt;&lt;P&gt;CELL_CALL_CNT_M3 - count of cell calls-June&lt;/P&gt;&lt;P&gt;CELL_CALL_CNT_M4 - count of cell calls-July&lt;/P&gt;&lt;P&gt;CELL_CALL_CNT_M5 - count of cell calls-August&lt;/P&gt;&lt;P&gt;CELL_CALL_CNT_M6 - count of cell calls-September&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Say, I'd like to filter out data for the months of April, May &amp;amp; June. So I was thinking if we can apply filters on labels.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Any suggestions !??&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 28 Mar 2016 08:32:00 GMT</pubDate>
    <dc:creator>pradeepvaranasi</dc:creator>
    <dc:date>2016-03-28T08:32:00Z</dc:date>
    <item>
      <title>Can we apply filters on labels in a dataset ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-we-apply-filters-on-labels-in-a-dataset/m-p/259277#M50133</link>
      <description>&lt;P&gt;For instance I have my variables - Labels in the below fomat:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CELL_CALL_CNT_M1 - count of cell calls-April&lt;/P&gt;&lt;P&gt;CELL_CALL_CNT_M2 - count of cell calls-May&lt;/P&gt;&lt;P&gt;CELL_CALL_CNT_M3 - count of cell calls-June&lt;/P&gt;&lt;P&gt;CELL_CALL_CNT_M4 - count of cell calls-July&lt;/P&gt;&lt;P&gt;CELL_CALL_CNT_M5 - count of cell calls-August&lt;/P&gt;&lt;P&gt;CELL_CALL_CNT_M6 - count of cell calls-September&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Say, I'd like to filter out data for the months of April, May &amp;amp; June. So I was thinking if we can apply filters on labels.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Any suggestions !??&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2016 08:32:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-we-apply-filters-on-labels-in-a-dataset/m-p/259277#M50133</guid>
      <dc:creator>pradeepvaranasi</dc:creator>
      <dc:date>2016-03-28T08:32:00Z</dc:date>
    </item>
    <item>
      <title>Re: Can we apply filters on labels in a dataset ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-we-apply-filters-on-labels-in-a-dataset/m-p/259279#M50135</link>
      <description>&lt;P&gt;No.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you explain your situation and problem with some detail perhaps we can make alternative suggestions.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Mar 2016 21:18:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-we-apply-filters-on-labels-in-a-dataset/m-p/259279#M50135</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-27T21:18:52Z</dc:date>
    </item>
    <item>
      <title>Re: Can we apply filters on labels in a dataset ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-we-apply-filters-on-labels-in-a-dataset/m-p/259281#M50137</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/71920"&gt;@pradeepvaranasi﻿&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you mean something like "restrict a dataset or apply a procedure to variables whose labels&amp;nbsp;meet certain criteria," then yes: We&amp;nbsp;can create the corresponding variable list by means of PROC SQL and DICTIONARY.COLUMNS and then use it&amp;nbsp;in a suitable statement or dataset option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example: Restrict PROC PRINT output of SASHELP.DEMOGRAPHICS to country name and variables whose labels mention the year 2005.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select name into :vlist separated by ' '
from dictionary.columns
where libname='SASHELP' &amp;amp; memname='DEMOGRAPHICS'
      &amp;amp; findw(label, '2005');
quit;

proc print data=sashelp.demographics(obs=10) label;
var isoname &amp;amp;vlist;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Mar 2016 21:44:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-we-apply-filters-on-labels-in-a-dataset/m-p/259281#M50137</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-03-27T21:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: Can we apply filters on labels in a dataset ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-we-apply-filters-on-labels-in-a-dataset/m-p/259282#M50138</link>
      <description>IMO that doesn't use the labels in filter, except in a roundabout way. Theoretically can also use vlabel but depends on what OP wants.</description>
      <pubDate>Sun, 27 Mar 2016 21:51:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-we-apply-filters-on-labels-in-a-dataset/m-p/259282#M50138</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-27T21:51:32Z</dc:date>
    </item>
    <item>
      <title>Re: Can we apply filters on labels in a dataset ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-we-apply-filters-on-labels-in-a-dataset/m-p/259360#M50178</link>
      <description>&lt;P&gt;Does this imply that at some time you have lables with values for April associated with a different variable name? If not then just keep the correct variables. If the differing names is the case then the data should be normalized (probably transposed ) to include a separate variable to indicate the month and then the exercise becomes selecting the values of month (or date even).&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2016 15:13:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-we-apply-filters-on-labels-in-a-dataset/m-p/259360#M50178</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-03-28T15:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: Can we apply filters on labels in a dataset ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-we-apply-filters-on-labels-in-a-dataset/m-p/259364#M50179</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/71920"&gt;@pradeepvaranasi﻿&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for adding more details to your initial post. It seems that the technique I suggested is applicable. Here's how:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Create test data */

data have;
label CELL_CALL_CNT_M1 = 'count of cell calls-April'
      CELL_CALL_CNT_M2 = 'count of cell calls-May'
      CELL_CALL_CNT_M3 = 'count of cell calls-June'
      CELL_CALL_CNT_M4 = 'count of cell calls-July'
      CELL_CALL_CNT_M5 = 'count of cell calls-August'
      CELL_CALL_CNT_M6 = 'count of cell calls-September'
      ;
length C: 8;
run; /* dataset with 6 variables */

/* Select variables */

proc sql noprint;
select name into :vlist separated by ' '
from dictionary.columns
where libname='WORK' &amp;amp; memname='HAVE'
      &amp;amp; scan(label,2,'-') in ('April','May','June');
quit;

data want;
set have(keep=&amp;amp;vlist);
run; /* dataset with 3 variables */&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;As you see, you can choose the appropriate character function, be it FINDW (as in my first example), SCAN (as above), INDEX, ..., and logical operators to specify your filter criterion on the labels.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2016 15:40:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-we-apply-filters-on-labels-in-a-dataset/m-p/259364#M50179</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-03-28T15:40:24Z</dc:date>
    </item>
  </channel>
</rss>

