<?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: subset in data step in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/subset-in-data-step/m-p/118641#M24456</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Post your full code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 25 Jun 2013 18:55:22 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2013-06-25T18:55:22Z</dc:date>
    <item>
      <title>subset in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/subset-in-data-step/m-p/118640#M24455</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;hi, I have dataset, for example like this:&lt;/P&gt;&lt;P&gt;data NAME1;&lt;/P&gt;&lt;P&gt;infile datalines delimiter=",';&lt;/P&gt;&lt;P&gt;input name $ gender $ age;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;AB,F,1&lt;/P&gt;&lt;P&gt;CD,M,2&lt;/P&gt;&lt;P&gt;XX,F,2&lt;/P&gt;&lt;P&gt;OO,M,3.5&lt;/P&gt;&lt;P&gt;PP,F,2&lt;/P&gt;&lt;P&gt;AC,F,2&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a prompt value (NAMA_SELECTED) which user enter names. So if user enter ALL, all or leave it blank, I want to export all the records to the dataset SELECTED_PEOPLE. If user enter AB and/or CD only, these two records should be exported to SELECTED_PEOPLE dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use %_eg_whereParam for subsetting when user enter AB. and/or CD, not problem. But when it come to check if the prompt value is ALL, or all or blank, it just cannot output everything. I am using if "&amp;amp;NAMA_SELECTED" = 'ALL' or "&amp;amp;NAMA_SELECTED" = 'all' or "&amp;amp;NAMA_SELECTED" = ' ' then do; output;end;&lt;/P&gt;&lt;P&gt;What's wrong this logic?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jun 2013 18:53:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/subset-in-data-step/m-p/118640#M24455</guid>
      <dc:creator>YW_CA</dc:creator>
      <dc:date>2013-06-25T18:53:38Z</dc:date>
    </item>
    <item>
      <title>Re: subset in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/subset-in-data-step/m-p/118641#M24456</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Post your full code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jun 2013 18:55:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/subset-in-data-step/m-p/118641#M24456</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-06-25T18:55:22Z</dc:date>
    </item>
    <item>
      <title>Re: subset in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/subset-in-data-step/m-p/118642#M24457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;here is step for subsetting:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data selected_names;&lt;/P&gt;&lt;P&gt;set NAME1;&lt;/P&gt;&lt;P&gt;if "&amp;amp;NAME_SELECTED" = 'ALL' or "&amp;amp;NAME_SELECTED" = 'all' or "&amp;amp;NAME_SELECTED" = ' ' then do;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;else do;&lt;/P&gt;&lt;P&gt;where %_eg_whereParam(name, NAME_SELECTED,IN,TYPE=S);&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jun 2013 20:26:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/subset-in-data-step/m-p/118642#M24457</guid>
      <dc:creator>YW_CA</dc:creator>
      <dc:date>2013-06-25T20:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: subset in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/subset-in-data-step/m-p/118643#M24458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Slight improvement but depending on people may be usefule:&lt;/P&gt;&lt;P&gt; if upcase("&amp;amp;NAME_SELECTED") = 'ALL'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;will handle ALL, All, aLL, alL, all and others.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jun 2013 21:32:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/subset-in-data-step/m-p/118643#M24458</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2013-06-25T21:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: subset in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/subset-in-data-step/m-p/118644#M24459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;does not work. From the log, the step took the if as where and did the&amp;nbsp; where NAME = 'ALL' logic, which is similar to what I've seen before.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jun 2013 23:31:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/subset-in-data-step/m-p/118644#M24459</guid>
      <dc:creator>YW_CA</dc:creator>
      <dc:date>2013-06-25T23:31:31Z</dc:date>
    </item>
    <item>
      <title>Re: subset in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/subset-in-data-step/m-p/118645#M24460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;interesting, if I comment out the else do logic. just leave the first if&amp;nbsp; end in the datastep. it export all the records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data selected_names;&lt;/P&gt;&lt;P&gt;set NAME1;&lt;/P&gt;&lt;P&gt;if "&amp;amp;NAME_SELECTED" = 'ALL' or "&amp;amp;NAME_SELECTED" = 'all' or "&amp;amp;NAME_SELECTED" = ' ' then do;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;else do; /*&lt;/P&gt;&lt;P&gt;where %_eg_whereParam(name, NAME_SELECTED,IN,TYPE=S);&lt;/P&gt;&lt;P&gt;OUTPUT;*/&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jun 2013 23:37:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/subset-in-data-step/m-p/118645#M24460</guid>
      <dc:creator>YW_CA</dc:creator>
      <dc:date>2013-06-25T23:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: subset in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/subset-in-data-step/m-p/118646#M24461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;WHERE statement is applied before the data is read into the data step.&amp;nbsp; Placing it inside of a conditional does not change this.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Use IF statement instead if you want to apply the filter conditionally.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Jun 2013 00:07:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/subset-in-data-step/m-p/118646#M24461</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-06-26T00:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: subset in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/subset-in-data-step/m-p/118647#M24462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;%macro filter;&lt;/P&gt;&lt;P&gt;data selected_names;&lt;/P&gt;&lt;P&gt;set NAME1;&lt;/P&gt;&lt;P&gt;%if %upcase(&amp;amp;NAME_SELECTED) ^= ALL and &amp;amp;NAME_SELECTED ne %then %do;&lt;/P&gt;&lt;P&gt;where %_eg_whereParam(name, NAME_SELECTED,IN,TYPE=S);&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;%filter;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Jun 2013 08:54:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/subset-in-data-step/m-p/118647#M24462</guid>
      <dc:creator>Vladislaff</dc:creator>
      <dc:date>2013-06-26T08:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: subset in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/subset-in-data-step/m-p/118648#M24463</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use If and else if instead of else and where&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Jun 2013 09:08:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/subset-in-data-step/m-p/118648#M24463</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2013-06-26T09:08:33Z</dc:date>
    </item>
  </channel>
</rss>

