<?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: Limiting Number of Values Used in PROC Report in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Limiting-Number-of-Values-Used-in-PROC-Report/m-p/656793#M196952</link>
    <description>&lt;P&gt;I was able to use this as a starting point to create appropriate macros following a predictable pattern in my data. Thanks.&lt;/P&gt;</description>
    <pubDate>Thu, 11 Jun 2020 02:24:18 GMT</pubDate>
    <dc:creator>tburus</dc:creator>
    <dc:date>2020-06-11T02:24:18Z</dc:date>
    <item>
      <title>Limiting Number of Values Used in PROC Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Limiting-Number-of-Values-Used-in-PROC-Report/m-p/655955#M196748</link>
      <description>&lt;P&gt;I am trying to build a table with PROC Report that summarizes results for the last three years from a dataset containing results from the last 10 years. I am unsure how (if possible) to limit the number of years output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My current code is given below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=participating_programs; 
	column sport num_participating_programs,year;
	define sport / group f=$sport.;
	define year / across order=internal;
	define num_participating_programs / analysis sum '';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Jun 2020 06:06:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Limiting-Number-of-Values-Used-in-PROC-Report/m-p/655955#M196748</guid>
      <dc:creator>tburus</dc:creator>
      <dc:date>2020-06-10T06:06:03Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting Number of Values Used in PROC Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Limiting-Number-of-Values-Used-in-PROC-Report/m-p/656007#M196753</link>
      <description>Limit observations by adding a WHERE statement to the code.  For example you can add:&lt;BR /&gt;&lt;BR /&gt;where (2017 &amp;lt;= year &amp;lt;= 2019);</description>
      <pubDate>Wed, 10 Jun 2020 06:35:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Limiting-Number-of-Values-Used-in-PROC-Report/m-p/656007#M196753</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2020-06-10T06:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting Number of Values Used in PROC Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Limiting-Number-of-Values-Used-in-PROC-Report/m-p/656031#M196756</link>
      <description>&lt;P&gt;Okay, two things. One, my 'year' variable is a character variable. Two, I need to automate this to be run yearly (I will probably need to define a macro for this, which is fine).&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 06:48:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Limiting-Number-of-Values-Used-in-PROC-Report/m-p/656031#M196756</guid>
      <dc:creator>tburus</dc:creator>
      <dc:date>2020-06-10T06:48:18Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting Number of Values Used in PROC Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Limiting-Number-of-Values-Used-in-PROC-Report/m-p/656045#M196757</link>
      <description>That can all be done, just a little cumbersome:&lt;BR /&gt;&lt;BR /&gt;where put(year(today())-3, 4.) &amp;lt;= year &amp;lt;= put(year(today())-1, 4.);</description>
      <pubDate>Wed, 10 Jun 2020 06:54:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Limiting-Number-of-Values-Used-in-PROC-Report/m-p/656045#M196757</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2020-06-10T06:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting Number of Values Used in PROC Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Limiting-Number-of-Values-Used-in-PROC-Report/m-p/656062#M196758</link>
      <description>&lt;P&gt;Okay, I'm getting what I want now, but the way I'm doing it seems like it's going to be a mess to automate. Is there a way to do this using LAST.variable and counting back two?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 07:02:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Limiting-Number-of-Values-Used-in-PROC-Report/m-p/656062#M196758</guid>
      <dc:creator>tburus</dc:creator>
      <dc:date>2020-06-10T07:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting Number of Values Used in PROC Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Limiting-Number-of-Values-Used-in-PROC-Report/m-p/656301#M196779</link>
      <description>&lt;P&gt;Year as character needs 4 bytes. A complete SAS date can also be stored in 4 bytes, and a numeric year in the minimum of 3 bytes. So you should seriously reconsider your data design, as numeric values are easier to handle for such cut-off issues and the necessary calculations:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select max(year) into :maxyear from have;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and later&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where &amp;amp;maxyear. - 2 le year le &amp;amp;maxyear.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Jun 2020 09:26:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Limiting-Number-of-Values-Used-in-PROC-Report/m-p/656301#M196779</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-06-10T09:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting Number of Values Used in PROC Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Limiting-Number-of-Values-Used-in-PROC-Report/m-p/656409#M196812</link>
      <description>&lt;P&gt;Thanks. This almost gets me there. Unfortunately the 'Year' variable I receive is in the form "1819" for 2018-19, "1920" for 2019-20, etc. How might I go about converting this to a numeric? Then I could use your idea by adding and subtracting 101.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 13:48:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Limiting-Number-of-Values-Used-in-PROC-Report/m-p/656409#M196812</guid>
      <dc:creator>tburus</dc:creator>
      <dc:date>2020-06-10T13:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting Number of Values Used in PROC Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Limiting-Number-of-Values-Used-in-PROC-Report/m-p/656416#M196815</link>
      <description>&lt;P&gt;split the value and define low and high&lt;/P&gt;
&lt;P&gt;low='20'||substr(year,1,2)&lt;/P&gt;
&lt;P&gt;high='20'||substr(year,3,2)&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 13:53:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Limiting-Number-of-Values-Used-in-PROC-Report/m-p/656416#M196815</guid>
      <dc:creator>smantha</dc:creator>
      <dc:date>2020-06-10T13:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting Number of Values Used in PROC Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Limiting-Number-of-Values-Used-in-PROC-Report/m-p/656420#M196817</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/329503"&gt;@tburus&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;One, my 'year' variable is a character variable. &lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Almost always a poor idea.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And with any requirement to "automate" something related to dates then you really should use SAS date values. Then there are a bunch of tools available to manipulate the dates. With character variables the first thing you would have to do for something like " I want all of the records within the previous 3 years of today" is turn the values into dates. Save the effort later and do it once when values are created/ read.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where year(datevariable) ge (year(today()) -3)&lt;/P&gt;
&lt;P&gt;for instance.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 14:00:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Limiting-Number-of-Values-Used-in-PROC-Report/m-p/656420#M196817</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-06-10T14:00:18Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting Number of Values Used in PROC Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Limiting-Number-of-Values-Used-in-PROC-Report/m-p/656793#M196952</link>
      <description>&lt;P&gt;I was able to use this as a starting point to create appropriate macros following a predictable pattern in my data. Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2020 02:24:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Limiting-Number-of-Values-Used-in-PROC-Report/m-p/656793#M196952</guid>
      <dc:creator>tburus</dc:creator>
      <dc:date>2020-06-11T02:24:18Z</dc:date>
    </item>
  </channel>
</rss>

