<?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: Select cases in grade 1 across school years in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Select-cases-in-grade-1-across-school-years/m-p/307200#M65762</link>
    <description>&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/5484i34BC79C4B7DBAB1C/image-size/original?v=v2&amp;amp;px=-1" alt="2.jpg" title="2.jpg" border="0" /&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 25 Oct 2016 18:01:34 GMT</pubDate>
    <dc:creator>AnnThomas</dc:creator>
    <dc:date>2016-10-25T18:01:34Z</dc:date>
    <item>
      <title>Select cases in grade 1 across school years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-cases-in-grade-1-across-school-years/m-p/307184#M65759</link>
      <description>&lt;DIV&gt;I want to select only those cases that are in grade 1 in year 0405, and those that are in grade 1 in year 0506, and those that are in grade 1 in year 0607.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If I put a 'or' statement, it will give me out cases that are also in other grades, if I put an 'and' statement, no cases will be found.&lt;/DIV&gt;&lt;DIV&gt;What is the code to select cases across multiple years, but all should be in grade 1 at that particular year.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;&lt;FONT size="2" color="#000080" face="Courier New"&gt;&lt;FONT size="2" color="#000080" face="Courier New"&gt;&lt;FONT size="2" color="#000080" face="Courier New"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Courier New"&gt;&lt;FONT size="2" face="Courier New"&gt; total1; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" color="#0000ff" face="Courier New"&gt;&lt;FONT size="2" color="#0000ff" face="Courier New"&gt;&lt;FONT size="2" color="#0000ff" face="Courier New"&gt;set&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Courier New"&gt;&lt;FONT size="2" face="Courier New"&gt; total;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#0000ff" face="Courier New"&gt;&lt;FONT size="2" color="#0000ff" face="Courier New"&gt;&lt;FONT size="2" color="#0000ff" face="Courier New"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Courier New"&gt;&lt;FONT size="2" face="Courier New"&gt; (a1_grade_04050=&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT size="2" color="#008080" face="Courier New"&gt;&lt;FONT size="2" color="#008080" face="Courier New"&gt;&lt;FONT size="2" color="#008080" face="Courier New"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="2" face="Courier New"&gt;&lt;FONT size="2" face="Courier New"&gt;) or (a1_grade_05060=&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT size="2" color="#008080" face="Courier New"&gt;&lt;FONT size="2" color="#008080" face="Courier New"&gt;&lt;FONT size="2" color="#008080" face="Courier New"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="2" face="Courier New"&gt;&lt;FONT size="2" face="Courier New"&gt;) or (a1_grade_06070=1) &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" color="#0000ff" face="Courier New"&gt;&lt;FONT size="2" color="#0000ff" face="Courier New"&gt;&lt;FONT size="2" color="#0000ff" face="Courier New"&gt;then&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT size="2" color="#0000ff" face="Courier New"&gt;&lt;FONT size="2" color="#0000ff" face="Courier New"&gt;&lt;FONT size="2" color="#0000ff" face="Courier New"&gt;output&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Courier New"&gt;&lt;FONT size="2" face="Courier New"&gt; ;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#000080" face="Courier New"&gt;&lt;FONT size="2" color="#000080" face="Courier New"&gt;&lt;FONT size="2" color="#000080" face="Courier New"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Courier New"&gt;&lt;FONT size="2" face="Courier New"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#000080" face="Courier New"&gt;&lt;FONT size="2" color="#000080" face="Courier New"&gt;&lt;FONT size="2" color="#000080" face="Courier New"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Courier New"&gt;&lt;FONT size="2" face="Courier New"&gt; total1; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" color="#0000ff" face="Courier New"&gt;&lt;FONT size="2" color="#0000ff" face="Courier New"&gt;&lt;FONT size="2" color="#0000ff" face="Courier New"&gt;set&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Courier New"&gt;&lt;FONT size="2" face="Courier New"&gt; total;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" color="#0000ff" face="Courier New"&gt;&lt;FONT size="2" color="#0000ff" face="Courier New"&gt;&lt;FONT size="2" color="#0000ff" face="Courier New"&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#0000ff" face="Courier New"&gt;&lt;FONT size="2" color="#0000ff" face="Courier New"&gt;&lt;FONT size="2" color="#0000ff" face="Courier New"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Courier New"&gt;&lt;FONT size="2" face="Courier New"&gt; (a1_grade_04050=&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT size="2" color="#008080" face="Courier New"&gt;&lt;FONT size="2" color="#008080" face="Courier New"&gt;&lt;FONT size="2" color="#008080" face="Courier New"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="2" face="Courier New"&gt;&lt;FONT size="2" face="Courier New"&gt;) and (a1_grade_05060=&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT size="2" color="#008080" face="Courier New"&gt;&lt;FONT size="2" color="#008080" face="Courier New"&gt;&lt;FONT size="2" color="#008080" face="Courier New"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="2" face="Courier New"&gt;&lt;FONT size="2" face="Courier New"&gt;) and (a1_grade_06070=1) &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" color="#0000ff" face="Courier New"&gt;&lt;FONT size="2" color="#0000ff" face="Courier New"&gt;&lt;FONT size="2" color="#0000ff" face="Courier New"&gt;then&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT size="2" color="#0000ff" face="Courier New"&gt;&lt;FONT size="2" color="#0000ff" face="Courier New"&gt;&lt;FONT size="2" color="#0000ff" face="Courier New"&gt;output&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Courier New"&gt;&lt;FONT size="2" face="Courier New"&gt; ;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#000080" face="Courier New"&gt;&lt;FONT size="2" color="#000080" face="Courier New"&gt;&lt;FONT size="2" color="#000080" face="Courier New"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Courier New"&gt;&lt;FONT size="2" face="Courier New"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 25 Oct 2016 17:11:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-cases-in-grade-1-across-school-years/m-p/307184#M65759</guid>
      <dc:creator>AnnThomas</dc:creator>
      <dc:date>2016-10-25T17:11:24Z</dc:date>
    </item>
    <item>
      <title>Re: Select cases in grade 1 across school years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-cases-in-grade-1-across-school-years/m-p/307191#M65760</link>
      <description>&lt;P&gt;Using OR should work.&lt;/P&gt;
&lt;P&gt;If you get unwanted results please post example of your input and relevant output&lt;/P&gt;
&lt;P&gt;to display why it is not wanted&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 17:50:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-cases-in-grade-1-across-school-years/m-p/307191#M65760</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2016-10-25T17:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: Select cases in grade 1 across school years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-cases-in-grade-1-across-school-years/m-p/307196#M65761</link>
      <description>&lt;P&gt;You should describe, or better yet provide examples of, your data. The instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to create data step code that can be posted here to recreate your data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It will also help to provide an example of what the desired result for your example data would would be.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From the variables you show and your request "grade 1 in year 0405" part of the issue could well be the data structure. When variable names contain information you need to query or manipulate then that is a sign that the data should be restructured. In general a variable named Grade with values like 1 and another variable Year with values like '0405' or '0506' (if those indicate school year 2004 to 2005 or 2005 to 2006 that's another issue) then the desired result would be nearly trivial:&lt;/P&gt;
&lt;P&gt;If grade=1 and year in ('0405' '0506' '0607');&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 18:00:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-cases-in-grade-1-across-school-years/m-p/307196#M65761</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-10-25T18:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: Select cases in grade 1 across school years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-cases-in-grade-1-across-school-years/m-p/307200#M65762</link>
      <description>&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/5484i34BC79C4B7DBAB1C/image-size/original?v=v2&amp;amp;px=-1" alt="2.jpg" title="2.jpg" border="0" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 18:01:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-cases-in-grade-1-across-school-years/m-p/307200#M65762</guid>
      <dc:creator>AnnThomas</dc:creator>
      <dc:date>2016-10-25T18:01:34Z</dc:date>
    </item>
    <item>
      <title>Re: Select cases in grade 1 across school years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-cases-in-grade-1-across-school-years/m-p/307202#M65764</link>
      <description>&lt;P&gt;Thank you shmuel and ballardw.&lt;/P&gt;&lt;P&gt;Data cannot be changed, neither can be variable names.&lt;/P&gt;&lt;P&gt;With the or statement I get the correct number of observations in the log file, however when I look at the tables, also other grades, such as 0 (which is kindergarten), grade 2, and grade 3 are included. And I want just grade 1.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 18:04:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-cases-in-grade-1-across-school-years/m-p/307202#M65764</guid>
      <dc:creator>AnnThomas</dc:creator>
      <dc:date>2016-10-25T18:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: Select cases in grade 1 across school years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-cases-in-grade-1-across-school-years/m-p/307205#M65766</link>
      <description>&lt;P&gt;Your criteria is that any of the values are 1. This means the other values can be values other than 1.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Change your proc freq to be&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var1*var2*var3/list&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you'll see that at least one is a 1 in all cases.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 18:05:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-cases-in-grade-1-across-school-years/m-p/307205#M65766</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-25T18:05:25Z</dc:date>
    </item>
  </channel>
</rss>

