<?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: Compute with If Condition in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/258029#M49622</link>
    <description>&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; lastsex &lt;SPAN class="token operator"&gt;eq&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;1&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; lastage&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;0&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
      line x &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt;varying1&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt; lastage&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Could you explain what these two lines do?&amp;nbsp; They seem to matter why is lastage being set to 0?&lt;/P&gt;</description>
    <pubDate>Mon, 21 Mar 2016 17:19:41 GMT</pubDate>
    <dc:creator>DavidPhillips2</dc:creator>
    <dc:date>2016-03-21T17:19:41Z</dc:date>
    <item>
      <title>Compute with If Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/257638#M49471</link>
      <description>&lt;P&gt;Is there a way to do:&lt;/P&gt;&lt;P&gt;compute after gender but not after age&amp;nbsp; / style={background=blue};&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;line ' ';&lt;/P&gt;&lt;P&gt;&amp;nbsp;endcomp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2016 15:00:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/257638#M49471</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2016-03-18T15:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: Compute with If Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/257642#M49472</link>
      <description>&lt;P&gt;Well, there maybe in report, but I prefer pre-arranging data in a datastep, som my suggestion would be to add a break var into your dataset, i.e. its always 0, except when you line, then break on that.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2016 15:18:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/257642#M49472</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-03-18T15:18:02Z</dc:date>
    </item>
    <item>
      <title>Re: Compute with If Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/257651#M49475</link>
      <description>&lt;P&gt;I don't quite understand your example. &amp;nbsp;If you want a conditional line statement use $VARYING format as in the sample.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/kb/37/763.html" target="_self"&gt;http://support.sas.com/kb/37/763.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2016 15:56:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/257651#M49475</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-03-18T15:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: Compute with If Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/257657#M49480</link>
      <description>&lt;P&gt;See screen shot.&amp;nbsp; What I’m trying to do is only produce one line when the blue line is created rather than both the blue line and the light blue line.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;compute after gender&amp;nbsp;/ style={background=blue};&lt;BR /&gt;line ' ';&lt;BR /&gt;endcomp;&lt;BR /&gt;&lt;BR /&gt;compute after age&amp;nbsp;/ style={background=lightblue};&lt;BR /&gt;line ' ';&lt;BR /&gt;endcomp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12391iACF39F2943535C30/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="two lines.png" title="two lines.png" /&gt;</description>
      <pubDate>Fri, 18 Mar 2016 16:17:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/257657#M49480</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2016-03-18T16:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: Compute with If Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/257674#M49491</link>
      <description>&lt;P&gt;Which line do you want between Female and Male??? The light blue line or the dark blue line?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The technique described (to use $varying. is the correct technique to suppress a line statement. You CANNOT execute a LINE statement conditionally, but you can conditionally assign a value to a "helper" variable that specifies the length of the line. When the length of the line is 0, then PROC REPORT will suppress the line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please see this Tech Support note: &lt;A href="http://support.sas.com/kb/37/763.html" target="_blank"&gt;http://support.sas.com/kb/37/763.html&lt;/A&gt; which outlines the basic technique (illustrated with writing out text). And this paper &lt;A href="http://support.sas.com/resources/papers/proceedings11/246-2011.pdf" target="_blank"&gt;http://support.sas.com/resources/papers/proceedings11/246-2011.pdf&lt;/A&gt; has more examples and explanation on pages 12 and 13.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cynthia&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2016 18:15:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/257674#M49491</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-03-18T18:15:04Z</dc:date>
    </item>
    <item>
      <title>Re: Compute with If Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/257676#M49493</link>
      <description>&lt;P&gt;I want the last light blue line to not appear. &amp;nbsp;Currently playing with&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if residency_desc = "Total" then do;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;call define(_col_, 'style', 'style=[background=lightblue]');&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;line ' ';&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;else do;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;call define(_col_, 'style', 'style=[background=blue]');&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;line ' ';&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this produces two blank lines.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2016 18:32:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/257676#M49493</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2016-03-18T18:32:15Z</dc:date>
    </item>
    <item>
      <title>Re: Compute with If Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/257694#M49501</link>
      <description>&lt;P&gt;This might be helpful but seems a bit clunky.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort  data=sashelp.class out=class;	
	by sex age;
   run;
data report;
   set class;
   by sex age;
   lastsex = last.sex;
   lastage = last.age;
   run;
proc report nowd data=report list out=test;
   columns sex lastsex age lastage name height weight;
   define sex / order;
   define age / order;
   define lastsex / order noprint;
   define lastage / order noprint;
   define name / display;
   define height / display;
   define weight / display;
   compute after lastage / style={background=lightblue};
      x = ' ';
      if lastsex eq 1 then lastage=0;
      line x $varying1. lastage;
      endcomp; 
	compute after sex / style={background=blue};		
		line ' ';
		endcomp;
	run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/2375iD59AAE17D04B191E/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="Capture.PNG" title="Capture.PNG" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2016 20:12:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/257694#M49501</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-03-18T20:12:38Z</dc:date>
    </item>
    <item>
      <title>Re: Compute with If Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/258029#M49622</link>
      <description>&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; lastsex &lt;SPAN class="token operator"&gt;eq&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;1&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; lastage&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;0&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
      line x &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt;varying1&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt; lastage&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Could you explain what these two lines do?&amp;nbsp; They seem to matter why is lastage being set to 0?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2016 17:19:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/258029#M49622</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2016-03-21T17:19:41Z</dc:date>
    </item>
    <item>
      <title>Re: Compute with If Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/258099#M49651</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/5059"&gt;@DavidPhillips2&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; lastsex &lt;SPAN class="token operator"&gt;eq&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;1&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; lastage&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;0&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
      line x &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt;varying1&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt; lastage&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Could you explain what these two lines do?&amp;nbsp; They seem to matter why is lastage being set to 0?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Lastage is both the indicator of last obs for an age group and used as the length for X in $VARYING. &amp;nbsp;When LASTAGE is 0 it keeps the compute from printing a light blue line. &amp;nbsp;Otherwise there would be a line between each row. &amp;nbsp;When it is LASTSEX it is also LASTAGE but we want to suppress the printing of that line so set it (LASTAGE) to 0 and $VARYING prints nothing.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2016 21:29:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/258099#M49651</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-03-21T21:29:44Z</dc:date>
    </item>
    <item>
      <title>Re: Compute with If Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/258215#M49694</link>
      <description>&lt;P&gt;When I run this with my dataset and a third column I run into:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: Variable lastsex is uninitialized.ERROR: An unknown, abnormal error has occurred. This step is being terminated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It’s hard to replicate my scenario via a post. &amp;nbsp;Working on a simplification so I can post code and data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This block is causing the error for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;  &lt;SPAN class="token keyword"&gt;compute&lt;/SPAN&gt; after lastage &lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;style&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;{&lt;/SPAN&gt;background&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;lightblue&lt;SPAN class="token punctuation"&gt;}&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
      x &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;' '&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
      &lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; lastsex &lt;SPAN class="token operator"&gt;eq&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;1&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; lastage&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;0&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
      line x &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt;varying1&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt; lastage&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
      &lt;SPAN class="token keyword"&gt;endcomp&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Mar 2016 15:02:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/258215#M49694</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2016-03-22T15:02:58Z</dc:date>
    </item>
    <item>
      <title>Re: Compute with If Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/258228#M49699</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/5059"&gt;@DavidPhillips2&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;When I run this with my dataset and a third column I run into:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOTE: Variable lastsex is uninitialized.ERROR: An unknown, abnormal error has occurred. This step is being terminated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It’s hard to replicate my scenario via a post. &amp;nbsp;Working on a simplification so I can post code and data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This block is causing the error for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;  &lt;SPAN class="token keyword"&gt;compute&lt;/SPAN&gt; after lastage &lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;style&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;{&lt;/SPAN&gt;background&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;lightblue&lt;SPAN class="token punctuation"&gt;}&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
      x &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;' '&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
      &lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; lastsex &lt;SPAN class="token operator"&gt;eq&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;1&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; lastage&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;0&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
      line x &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt;varying1&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt; lastage&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
      &lt;SPAN class="token keyword"&gt;endcomp&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to create "last" indicator variables for your data as I did in this step. &amp;nbsp;They also go in the column statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data report;
   set class;
   by sex age;
   lastsex = last.sex;
   lastage = last.age;
   run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Mar 2016 15:32:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/258228#M49699</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-03-22T15:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: Compute with If Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/258254#M49707</link>
      <description>&lt;P&gt;This is a bit simplified.&amp;nbsp; Still simplifying and working on getting data for the post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sort data=all;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;by gender residency eth;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data all; set all;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; by gender residency eth;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lastGender = last.gender;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lastResidency = last.residency;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lastEth = last.eth;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc report data=all;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; column (gender residency eth growthDeclineColumn perGrowthDeclineColumn lastGender lastResidency lastEth &amp;nbsp; &amp;nbsp; academic_period_desc , n);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;define gender / group&amp;nbsp; '' order=data;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;define residency / group&amp;nbsp; '' order=data;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;define eth / group '' order=internal;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;define lastEth / order=data;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;define lastResidency / order=data;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;define lastGender / order=data;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;define growthDeclineColumn &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; / group noprint '' order = data;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;define perGrowthDeclineColumn &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; / group noprint '' order = data;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;define academic_period_desc &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; / across ''&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;define n&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; / analysis sum '' &amp;amp;tabulateFormatClause;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;compute eth;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if eth=&lt;STRONG&gt;99&lt;/STRONG&gt;&amp;nbsp; then call define(_row_,'style','style={font_weight=bold}');&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;endcomp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; compute n;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if growthDeclineColumn = &lt;STRONG&gt;1&lt;/STRONG&gt; then call &amp;amp;shortFormat;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if perGrowthDeclineColumn = &lt;STRONG&gt;1&lt;/STRONG&gt; then call define(_col_,'format','percent8.2');&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;endcomp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;compute after residency / style=[background=blue];&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;x = ' ';&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if lastGender eq &lt;STRONG&gt;1&lt;/STRONG&gt; then lastResidency =&lt;STRONG&gt;0&lt;/STRONG&gt;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;line x $varying1. &lt;SPAN&gt;lastResidency&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;endcomp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2016 16:34:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/258254#M49707</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2016-03-22T16:34:58Z</dc:date>
    </item>
    <item>
      <title>Re: Compute with If Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/258289#M49716</link>
      <description>&lt;P&gt;if lastReport1 eq 1 or lastReport1 eq . &amp;nbsp;then lastReport2 =0;&amp;nbsp;&lt;/P&gt;&lt;P&gt;makes the proc report show without coloring. &amp;nbsp;Oddly proc print of dataset all displays lastReport1 with values. &amp;nbsp;I wonder if this has to do with the after statements.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2016 17:40:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/258289#M49716</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2016-03-22T17:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: Compute with If Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/258297#M49719</link>
      <description>&lt;P&gt;You need to move the LAST indicator variables to the LEFT in the column statement. &amp;nbsp;Notice in my example they are not at the end.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2016 18:39:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/258297#M49719</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-03-22T18:39:06Z</dc:date>
    </item>
    <item>
      <title>Re: Compute with If Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/258328#M49734</link>
      <description>&lt;P&gt;After moving them to the left the same error occurs.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2016 18:54:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/258328#M49734</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2016-03-22T18:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: Compute with If Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/258344#M49738</link>
      <description>&lt;P&gt;Why are you using order=data?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Without a working example (like the one I wrote for you) I cannot help you debug your program. &amp;nbsp;Working means includes DATA.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2016 19:30:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/258344#M49738</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-03-22T19:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: Compute with If Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/258525#M49817</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data all;&lt;BR /&gt;infile datalines DLM=',';&lt;BR /&gt;input GENDER $ residency_desc : $20. schev_ethnicity_desc $ ACADEMIC_PERIOD_DESC : $20. n&lt;BR /&gt;growthDeclineColumn perGrowthDeclineColumn lastGender lastResidency_desc lastSchev_ethnicity_desc ;&lt;BR /&gt;datalines;&lt;BR /&gt;Female,In-state,1,Fall 2015,1,0,0,0,0,1&lt;BR /&gt;Female,In-state,2,Fall 2015,47,0,0,0,0,1&lt;BR /&gt;Female,In-state,3,Fall 2015,18,0,0,0,0,1&lt;BR /&gt;Female,In-state,5,Fall 2015,20,0,0,0,0,1&lt;BR /&gt;Female,In-state,6,Fall 2015,30,0,0,0,0,1&lt;BR /&gt;Female,In-state,8,Fall 2015,230,0,0,0,0,1&lt;BR /&gt;Female,In-state,9,Fall 2015,3,0,0,0,0,1&lt;BR /&gt;Female,In-state,10,Fall 2015,6,0,0,0,0,1&lt;BR /&gt;Female,In-state,99,Fall 2015,355,0,0,0,1,1&lt;BR /&gt;Female,Out-of-state,2,Fall 2015,21,0,0,0,0,1&lt;BR /&gt;Female,Out-of-state,3,Fall 2015,13,0,0,0,0,1&lt;BR /&gt;Female,Out-of-state,5,Fall 2015,6,0,0,0,0,1&lt;BR /&gt;Female,Out-of-state,6,Fall 2015,11,0,0,0,0,1&lt;BR /&gt;Female,Out-of-state,8,Fall 2015,72,0,0,0,0,1&lt;BR /&gt;Female,Out-of-state,9,Fall 2015,10,0,0,0,0,1&lt;BR /&gt;Female,Out-of-state,99,Fall 2015,133,0,0,0,1,1&lt;BR /&gt;Female,Total,1,Fall 2015,1,0,0,0,0,1&lt;BR /&gt;Female,Total,2,Fall 2015,68,0,0,0,0,1&lt;BR /&gt;Female,Total,3,Fall 2015,31,0,0,0,0,1&lt;BR /&gt;Female,Total,5,Fall 2015,26,0,0,0,0,1&lt;BR /&gt;Female,Total,6,Fall 2015,41,0,0,0,0,1&lt;BR /&gt;Female,Total,8,Fall 2015,302,0,0,0,0,1&lt;BR /&gt;Female,Total,9,Fall 2015,13,0,0,0,0,1&lt;BR /&gt;Female,Total,10,Fall 2015,6,0,0,0,0,1&lt;BR /&gt;Female,Total,99,Fall 2015,488,0,0,0,0,0&lt;BR /&gt;Female,Total,99,Fall 2015,488,0,0,1,1,1&lt;BR /&gt;Male,In-state,1,Fall 2015,1,0,0,0,0,1&lt;BR /&gt;Male,In-state,2,Fall 2015,23,0,0,0,0,1&lt;BR /&gt;Male,In-state,3,Fall 2015,10,0,0,0,0,1&lt;BR /&gt;Male,In-state,5,Fall 2015,6,0,0,0,0,1&lt;BR /&gt;Male,In-state,6,Fall 2015,14,0,0,0,0,1&lt;BR /&gt;Male,In-state,8,Fall 2015,87,0,0,0,0,1&lt;BR /&gt;Male,In-state,9,Fall 2015,1,0,0,0,0,1&lt;BR /&gt;Male,In-state,10,Fall 2015,3,0,0,0,0,1&lt;BR /&gt;Male,In-state,99,Fall 2015,145,0,0,0,1,1&lt;BR /&gt;Male,Out-of-state,2,Fall 2015,4,0,0,0,0,1&lt;BR /&gt;Male,Out-of-state,3,Fall 2015,2,0,0,0,0,1&lt;BR /&gt;Male,Out-of-state,5,Fall 2015,1,0,0,0,0,1&lt;BR /&gt;Male,Out-of-state,6,Fall 2015,2,0,0,0,0,1&lt;BR /&gt;Male,Out-of-state,8,Fall 2015,16,0,0,0,0,1&lt;BR /&gt;Male,Out-of-state,9,Fall 2015,3,0,0,0,0,1&lt;BR /&gt;Male,Out-of-state,99,Fall 2015,28,0,0,0,1,1&lt;BR /&gt;Male,Total,1,Fall 2015,1,0,0,0,0,1&lt;BR /&gt;Male,Total,2,Fall 2015,27,0,0,0,0,1&lt;BR /&gt;Male,Total,3,Fall 2015,12,0,0,0,0,1&lt;BR /&gt;Male,Total,5,Fall 2015,7,0,0,0,0,1&lt;BR /&gt;Male,Total,6,Fall 2015,16,0,0,0,0,1&lt;BR /&gt;Male,Total,8,Fall 2015,103,0,0,0,0,1&lt;BR /&gt;Male,Total,9,Fall 2015,4,0,0,0,0,1&lt;BR /&gt;Male,Total,10,Fall 2015,3,0,0,0,0,1&lt;BR /&gt;Male,Total,99,Fall 2015,173,0,0,0,0,0&lt;BR /&gt;Male,Total,99,Fall 2015,173,0,0,1,1,1&lt;BR /&gt;Total,In-state,1,Fall 2015,2,0,0,0,0,1&lt;BR /&gt;Total,In-state,2,Fall 2015,70,0,0,0,0,1&lt;BR /&gt;Total,In-state,3,Fall 2015,28,0,0,0,0,1&lt;BR /&gt;Total,In-state,5,Fall 2015,26,0,0,0,0,1&lt;BR /&gt;Total,In-state,6,Fall 2015,44,0,0,0,0,1&lt;BR /&gt;Total,In-state,8,Fall 2015,317,0,0,0,0,1&lt;BR /&gt;Total,In-state,9,Fall 2015,4,0,0,0,0,1&lt;BR /&gt;Total,In-state,10,Fall 2015,9,0,0,0,0,1&lt;BR /&gt;Total,In-state,99,Fall 2015,500,0,0,0,1,1&lt;BR /&gt;Total,Out-of-state,2,Fall 2015,25,0,0,0,0,1&lt;BR /&gt;Total,Out-of-state,3,Fall 2015,15,0,0,0,0,1&lt;BR /&gt;Total,Out-of-state,5,Fall 2015,7,0,0,0,0,1&lt;BR /&gt;Total,Out-of-state,6,Fall 2015,13,0,0,0,0,1&lt;BR /&gt;Total,Out-of-state,8,Fall 2015,88,0,0,0,0,1&lt;BR /&gt;Total,Out-of-state,9,Fall 2015,13,0,0,0,0,1&lt;BR /&gt;Total,Out-of-state,99,Fall 2015,161,0,0,0,1,1&lt;BR /&gt;Total,Total,1,Fall 2015,2,0,0,0,0,1&lt;BR /&gt;Total,Total,2,Fall 2015,95,0,0,0,0,1&lt;BR /&gt;Total,Total,3,Fall 2015,43,0,0,0,0,1&lt;BR /&gt;Total,Total,5,Fall 2015,33,0,0,0,0,1&lt;BR /&gt;Total,Total,6,Fall 2015,57,0,0,0,0,1&lt;BR /&gt;Total,Total,8,Fall 2015,405,0,0,0,0,1&lt;BR /&gt;Total,Total,9,Fall 2015,17,0,0,0,0,1&lt;BR /&gt;Total,Total,10,Fall 2015,9,0,0,0,0,1&lt;BR /&gt;Total,Total,99,Fall 2015,661,0,0,0,0,0&lt;BR /&gt;Total,Total,99,Fall 2015,661,0,0,1,1,1&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc report data=all;&lt;BR /&gt;&lt;BR /&gt;column (lastGender lastResidency_desc lastSchev_ethnicity_desc gender residency_desc schev_ethnicity_desc academic_period_desc, n);&lt;/P&gt;&lt;P&gt;define gender / group '' order=data;&lt;BR /&gt;define residency_desc / group '' order=data;&lt;BR /&gt;define schev_ethnicity_desc / group '' order=internal;&lt;/P&gt;&lt;P&gt;define lastGender / order=internal;&lt;BR /&gt;define lastResidency_desc / order=internal;&lt;BR /&gt;define lastSchev_ethnicity_desc / order=internal;&lt;/P&gt;&lt;P&gt;define academic_period_desc / across '';&lt;BR /&gt;define n / analysis sum '';&lt;/P&gt;&lt;P&gt;/*compute after residency_desc / style=[background=blue];&lt;BR /&gt;x = ' ';&lt;BR /&gt;if lastGender eq 1 then lastResidency_desc =0;&lt;BR /&gt;line x $varying1. lastResidency_desc;&lt;BR /&gt;endcomp; */&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2016 13:59:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/258525#M49817</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2016-03-23T13:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: Compute with If Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/258549#M49824</link>
      <description>&lt;P&gt;I changed the data type on SCHEV_ETHNICITY_DESC I don't think this can work with order=data. &amp;nbsp;I don't understand the extra rows of total 99. &amp;nbsp;I think it's close.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/2431i24083C8C73253EAD/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="Capture.PNG" title="Capture.PNG" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data all;
infile datalines DLM=',';
input GENDER $ residency_desc : $20. schev_ethnicity_desc ACADEMIC_PERIOD_DESC : $20. n
growthDeclineColumn perGrowthDeclineColumn lastGender lastResidency_desc lastSchev_ethnicity_desc ;
datalines;
Female,In-state,1,Fall 2015,1,0,0,0,0,1
Female,In-state,2,Fall 2015,47,0,0,0,0,1
Female,In-state,3,Fall 2015,18,0,0,0,0,1
Female,In-state,5,Fall 2015,20,0,0,0,0,1
Female,In-state,6,Fall 2015,30,0,0,0,0,1
Female,In-state,8,Fall 2015,230,0,0,0,0,1
Female,In-state,9,Fall 2015,3,0,0,0,0,1
Female,In-state,10,Fall 2015,6,0,0,0,0,1
Female,In-state,99,Fall 2015,355,0,0,0,1,1
Female,Out-of-state,2,Fall 2015,21,0,0,0,0,1
Female,Out-of-state,3,Fall 2015,13,0,0,0,0,1
Female,Out-of-state,5,Fall 2015,6,0,0,0,0,1
Female,Out-of-state,6,Fall 2015,11,0,0,0,0,1
Female,Out-of-state,8,Fall 2015,72,0,0,0,0,1
Female,Out-of-state,9,Fall 2015,10,0,0,0,0,1
Female,Out-of-state,99,Fall 2015,133,0,0,0,1,1
Female,Total,1,Fall 2015,1,0,0,0,0,1
Female,Total,2,Fall 2015,68,0,0,0,0,1
Female,Total,3,Fall 2015,31,0,0,0,0,1
Female,Total,5,Fall 2015,26,0,0,0,0,1
Female,Total,6,Fall 2015,41,0,0,0,0,1
Female,Total,8,Fall 2015,302,0,0,0,0,1
Female,Total,9,Fall 2015,13,0,0,0,0,1
Female,Total,10,Fall 2015,6,0,0,0,0,1
Female,Total,99,Fall 2015,488,0,0,0,0,0
Female,Total,99,Fall 2015,488,0,0,1,1,1
Male,In-state,1,Fall 2015,1,0,0,0,0,1
Male,In-state,2,Fall 2015,23,0,0,0,0,1
Male,In-state,3,Fall 2015,10,0,0,0,0,1
Male,In-state,5,Fall 2015,6,0,0,0,0,1
Male,In-state,6,Fall 2015,14,0,0,0,0,1
Male,In-state,8,Fall 2015,87,0,0,0,0,1
Male,In-state,9,Fall 2015,1,0,0,0,0,1
Male,In-state,10,Fall 2015,3,0,0,0,0,1
Male,In-state,99,Fall 2015,145,0,0,0,1,1
Male,Out-of-state,2,Fall 2015,4,0,0,0,0,1
Male,Out-of-state,3,Fall 2015,2,0,0,0,0,1
Male,Out-of-state,5,Fall 2015,1,0,0,0,0,1
Male,Out-of-state,6,Fall 2015,2,0,0,0,0,1
Male,Out-of-state,8,Fall 2015,16,0,0,0,0,1
Male,Out-of-state,9,Fall 2015,3,0,0,0,0,1
Male,Out-of-state,99,Fall 2015,28,0,0,0,1,1
Male,Total,1,Fall 2015,1,0,0,0,0,1
Male,Total,2,Fall 2015,27,0,0,0,0,1
Male,Total,3,Fall 2015,12,0,0,0,0,1
Male,Total,5,Fall 2015,7,0,0,0,0,1
Male,Total,6,Fall 2015,16,0,0,0,0,1
Male,Total,8,Fall 2015,103,0,0,0,0,1
Male,Total,9,Fall 2015,4,0,0,0,0,1
Male,Total,10,Fall 2015,3,0,0,0,0,1
Male,Total,99,Fall 2015,173,0,0,0,0,0
Male,Total,99,Fall 2015,173,0,0,1,1,1
Total,In-state,1,Fall 2015,2,0,0,0,0,1
Total,In-state,2,Fall 2015,70,0,0,0,0,1
Total,In-state,3,Fall 2015,28,0,0,0,0,1
Total,In-state,5,Fall 2015,26,0,0,0,0,1
Total,In-state,6,Fall 2015,44,0,0,0,0,1
Total,In-state,8,Fall 2015,317,0,0,0,0,1
Total,In-state,9,Fall 2015,4,0,0,0,0,1
Total,In-state,10,Fall 2015,9,0,0,0,0,1
Total,In-state,99,Fall 2015,500,0,0,0,1,1
Total,Out-of-state,2,Fall 2015,25,0,0,0,0,1
Total,Out-of-state,3,Fall 2015,15,0,0,0,0,1
Total,Out-of-state,5,Fall 2015,7,0,0,0,0,1
Total,Out-of-state,6,Fall 2015,13,0,0,0,0,1
Total,Out-of-state,8,Fall 2015,88,0,0,0,0,1
Total,Out-of-state,9,Fall 2015,13,0,0,0,0,1
Total,Out-of-state,99,Fall 2015,161,0,0,0,1,1
Total,Total,1,Fall 2015,2,0,0,0,0,1
Total,Total,2,Fall 2015,95,0,0,0,0,1
Total,Total,3,Fall 2015,43,0,0,0,0,1
Total,Total,5,Fall 2015,33,0,0,0,0,1
Total,Total,6,Fall 2015,57,0,0,0,0,1
Total,Total,8,Fall 2015,405,0,0,0,0,1
Total,Total,9,Fall 2015,17,0,0,0,0,1
Total,Total,10,Fall 2015,9,0,0,0,0,1
Total,Total,99,Fall 2015,661,0,0,0,0,0
Total,Total,99,Fall 2015,661,0,0,1,1,1
;
 
proc report data=all list showall;
   column 
      (
         gender lastGender
         residency_desc lastResidency_desc
         lastSchev_ethnicity_desc schev_ethnicity_desc         
         academic_period_desc, n);
   define gender / group '';
   define residency_desc / group '';
   define schev_ethnicity_desc / group '' order=internal;
   define lastGender / order order=internal noprint;
   define lastResidency_desc / order order=internal noprint;
   define lastSchev_ethnicity_desc / order order=internal noprint;
   define academic_period_desc / across '';
   define n / analysis sum '';
   compute after lastResidency_desc / style={background=lightblue};
      x = ' ';
      if lastgender eq 1 then lastResidency_desc=0;
      line x $varying1. lastResidency_desc;
      endcomp; 
	compute after gender / style={background=blue};		
		line ' ';
		endcomp;
   run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Mar 2016 14:41:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/258549#M49824</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-03-23T14:41:30Z</dc:date>
    </item>
    <item>
      <title>Re: Compute with If Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/258894#M49968</link>
      <description>&lt;P&gt;How can I group the year column to show side by side?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data all;&lt;BR /&gt;infile datalines DLM=',';&lt;BR /&gt;input GENDER $ residency_desc : $20. schev_ethnicity_desc ACADEMIC_PERIOD_DESC : $20. n&lt;BR /&gt;growthDeclineColumn perGrowthDeclineColumn lastGender lastResidency_desc lastSchev_ethnicity_desc ;&lt;BR /&gt;datalines;&lt;BR /&gt;Female,In-state,1,Fall 2014,1,0,0,0,0,1&lt;BR /&gt;Female,In-state,2,Fall 2014,47,0,0,0,0,1&lt;BR /&gt;Female,In-state,3,Fall 2014,18,0,0,0,0,1&lt;BR /&gt;Female,In-state,5,Fall 2014,20,0,0,0,0,1&lt;BR /&gt;Female,In-state,6,Fall 2014,30,0,0,0,0,1&lt;BR /&gt;Female,In-state,8,Fall 2014,230,0,0,0,0,1&lt;BR /&gt;Female,In-state,9,Fall 2014,3,0,0,0,0,1&lt;BR /&gt;Female,In-state,10,Fall 2014,6,0,0,0,0,1&lt;BR /&gt;Female,In-state,99,Fall 2014,355,0,0,0,1,1&lt;BR /&gt;Female,Out-of-state,2,Fall 2014,21,0,0,0,0,1&lt;BR /&gt;Female,Out-of-state,3,Fall 2014,13,0,0,0,0,1&lt;BR /&gt;Female,Out-of-state,5,Fall 2014,6,0,0,0,0,1&lt;BR /&gt;Female,Out-of-state,6,Fall 2014,11,0,0,0,0,1&lt;BR /&gt;Female,Out-of-state,8,Fall 2014,72,0,0,0,0,1&lt;BR /&gt;Female,Out-of-state,9,Fall 2014,10,0,0,0,0,1&lt;BR /&gt;Female,Out-of-state,99,Fall 2014,133,0,0,0,1,1&lt;BR /&gt;Female,Total,1,Fall 2014,1,0,0,0,0,1&lt;BR /&gt;Female,Total,2,Fall 2014,68,0,0,0,0,1&lt;BR /&gt;Female,Total,3,Fall 2014,31,0,0,0,0,1&lt;BR /&gt;Female,Total,5,Fall 2014,26,0,0,0,0,1&lt;BR /&gt;Female,Total,6,Fall 2014,41,0,0,0,0,1&lt;BR /&gt;Female,Total,8,Fall 2014,302,0,0,0,0,1&lt;BR /&gt;Female,Total,9,Fall 2014,13,0,0,0,0,1&lt;BR /&gt;Female,Total,10,Fall 2014,6,0,0,0,0,1&lt;BR /&gt;Female,Total,99,Fall 2014,488,0,0,0,0,0&lt;BR /&gt;Female,Total,99,Fall 2014,488,0,0,1,1,1&lt;BR /&gt;Male,In-state,1,Fall 2014,1,0,0,0,0,1&lt;BR /&gt;Male,In-state,2,Fall 2014,23,0,0,0,0,1&lt;BR /&gt;Male,In-state,3,Fall 2014,10,0,0,0,0,1&lt;BR /&gt;Male,In-state,5,Fall 2014,6,0,0,0,0,1&lt;BR /&gt;Male,In-state,6,Fall 2014,14,0,0,0,0,1&lt;BR /&gt;Male,In-state,8,Fall 2014,87,0,0,0,0,1&lt;BR /&gt;Male,In-state,9,Fall 2014,1,0,0,0,0,1&lt;BR /&gt;Male,In-state,10,Fall 2014,3,0,0,0,0,1&lt;BR /&gt;Male,In-state,99,Fall 2014,145,0,0,0,1,1&lt;BR /&gt;Male,Out-of-state,2,Fall 2014,4,0,0,0,0,1&lt;BR /&gt;Male,Out-of-state,3,Fall 2014,2,0,0,0,0,1&lt;BR /&gt;Male,Out-of-state,5,Fall 2014,1,0,0,0,0,1&lt;BR /&gt;Male,Out-of-state,6,Fall 2014,2,0,0,0,0,1&lt;BR /&gt;Male,Out-of-state,8,Fall 2014,16,0,0,0,0,1&lt;BR /&gt;Male,Out-of-state,9,Fall 2014,3,0,0,0,0,1&lt;BR /&gt;Male,Out-of-state,99,Fall 2014,28,0,0,0,1,1&lt;BR /&gt;Male,Total,1,Fall 2014,1,0,0,0,0,1&lt;BR /&gt;Male,Total,2,Fall 2014,27,0,0,0,0,1&lt;BR /&gt;Male,Total,3,Fall 2014,12,0,0,0,0,1&lt;BR /&gt;Male,Total,5,Fall 2014,7,0,0,0,0,1&lt;BR /&gt;Male,Total,6,Fall 2014,16,0,0,0,0,1&lt;BR /&gt;Male,Total,8,Fall 2014,103,0,0,0,0,1&lt;BR /&gt;Male,Total,9,Fall 2014,4,0,0,0,0,1&lt;BR /&gt;Male,Total,10,Fall 2014,3,0,0,0,0,1&lt;BR /&gt;Male,Total,99,Fall 2014,173,0,0,0,0,0&lt;BR /&gt;Male,Total,99,Fall 2014,173,0,0,1,1,1&lt;BR /&gt;Total,In-state,1,Fall 2014,2,0,0,0,0,1&lt;BR /&gt;Total,In-state,2,Fall 2014,70,0,0,0,0,1&lt;BR /&gt;Total,In-state,3,Fall 2014,28,0,0,0,0,1&lt;BR /&gt;Total,In-state,5,Fall 2014,26,0,0,0,0,1&lt;BR /&gt;Total,In-state,6,Fall 2014,44,0,0,0,0,1&lt;BR /&gt;Total,In-state,8,Fall 2014,317,0,0,0,0,1&lt;BR /&gt;Total,In-state,9,Fall 2014,4,0,0,0,0,1&lt;BR /&gt;Total,In-state,10,Fall 2014,9,0,0,0,0,1&lt;BR /&gt;Total,In-state,99,Fall 2014,500,0,0,0,1,1&lt;BR /&gt;Total,Out-of-state,2,Fall 2014,25,0,0,0,0,1&lt;BR /&gt;Total,Out-of-state,3,Fall 2014,15,0,0,0,0,1&lt;BR /&gt;Total,Out-of-state,5,Fall 2014,7,0,0,0,0,1&lt;BR /&gt;Total,Out-of-state,6,Fall 2014,13,0,0,0,0,1&lt;BR /&gt;Total,Out-of-state,8,Fall 2014,88,0,0,0,0,1&lt;BR /&gt;Total,Out-of-state,9,Fall 2014,13,0,0,0,0,1&lt;BR /&gt;Total,Out-of-state,99,Fall 2014,161,0,0,0,1,1&lt;BR /&gt;Total,Total,1,Fall 2014,2,0,0,0,0,1&lt;BR /&gt;Total,Total,2,Fall 2014,95,0,0,0,0,1&lt;BR /&gt;Total,Total,3,Fall 2014,43,0,0,0,0,1&lt;BR /&gt;Total,Total,5,Fall 2014,33,0,0,0,0,1&lt;BR /&gt;Total,Total,6,Fall 2014,57,0,0,0,0,1&lt;BR /&gt;Total,Total,8,Fall 2014,405,0,0,0,0,1&lt;BR /&gt;Total,Total,9,Fall 2014,17,0,0,0,0,1&lt;BR /&gt;Total,Total,10,Fall 2014,9,0,0,0,0,1&lt;BR /&gt;Total,Total,99,Fall 2014,661,0,0,0,0,0&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Female,In-state,1,Fall 2015,1,0,0,0,0,1&lt;BR /&gt;Female,In-state,2,Fall 2015,47,0,0,0,0,1&lt;BR /&gt;Female,In-state,3,Fall 2015,18,0,0,0,0,1&lt;BR /&gt;Female,In-state,5,Fall 2015,20,0,0,0,0,1&lt;BR /&gt;Female,In-state,6,Fall 2015,30,0,0,0,0,1&lt;BR /&gt;Female,In-state,8,Fall 2015,230,0,0,0,0,1&lt;BR /&gt;Female,In-state,9,Fall 2015,3,0,0,0,0,1&lt;BR /&gt;Female,In-state,10,Fall 2015,6,0,0,0,0,1&lt;BR /&gt;Female,In-state,99,Fall 2015,355,0,0,0,1,1&lt;BR /&gt;Female,Out-of-state,2,Fall 2015,21,0,0,0,0,1&lt;BR /&gt;Female,Out-of-state,3,Fall 2015,13,0,0,0,0,1&lt;BR /&gt;Female,Out-of-state,5,Fall 2015,6,0,0,0,0,1&lt;BR /&gt;Female,Out-of-state,6,Fall 2015,11,0,0,0,0,1&lt;BR /&gt;Female,Out-of-state,8,Fall 2015,72,0,0,0,0,1&lt;BR /&gt;Female,Out-of-state,9,Fall 2015,10,0,0,0,0,1&lt;BR /&gt;Female,Out-of-state,99,Fall 2015,133,0,0,0,1,1&lt;BR /&gt;Female,Total,1,Fall 2015,1,0,0,0,0,1&lt;BR /&gt;Female,Total,2,Fall 2015,68,0,0,0,0,1&lt;BR /&gt;Female,Total,3,Fall 2015,31,0,0,0,0,1&lt;BR /&gt;Female,Total,5,Fall 2015,26,0,0,0,0,1&lt;BR /&gt;Female,Total,6,Fall 2015,41,0,0,0,0,1&lt;BR /&gt;Female,Total,8,Fall 2015,302,0,0,0,0,1&lt;BR /&gt;Female,Total,9,Fall 2015,13,0,0,0,0,1&lt;BR /&gt;Female,Total,10,Fall 2015,6,0,0,0,0,1&lt;BR /&gt;Female,Total,99,Fall 2015,488,0,0,0,0,0&lt;BR /&gt;Female,Total,99,Fall 2015,488,0,0,1,1,1&lt;BR /&gt;Male,In-state,1,Fall 2015,1,0,0,0,0,1&lt;BR /&gt;Male,In-state,2,Fall 2015,23,0,0,0,0,1&lt;BR /&gt;Male,In-state,3,Fall 2015,10,0,0,0,0,1&lt;BR /&gt;Male,In-state,5,Fall 2015,6,0,0,0,0,1&lt;BR /&gt;Male,In-state,6,Fall 2015,14,0,0,0,0,1&lt;BR /&gt;Male,In-state,8,Fall 2015,87,0,0,0,0,1&lt;BR /&gt;Male,In-state,9,Fall 2015,1,0,0,0,0,1&lt;BR /&gt;Male,In-state,10,Fall 2015,3,0,0,0,0,1&lt;BR /&gt;Male,In-state,99,Fall 2015,145,0,0,0,1,1&lt;BR /&gt;Male,Out-of-state,2,Fall 2015,4,0,0,0,0,1&lt;BR /&gt;Male,Out-of-state,3,Fall 2015,2,0,0,0,0,1&lt;BR /&gt;Male,Out-of-state,5,Fall 2015,1,0,0,0,0,1&lt;BR /&gt;Male,Out-of-state,6,Fall 2015,2,0,0,0,0,1&lt;BR /&gt;Male,Out-of-state,8,Fall 2015,16,0,0,0,0,1&lt;BR /&gt;Male,Out-of-state,9,Fall 2015,3,0,0,0,0,1&lt;BR /&gt;Male,Out-of-state,99,Fall 2015,28,0,0,0,1,1&lt;BR /&gt;Male,Total,1,Fall 2015,1,0,0,0,0,1&lt;BR /&gt;Male,Total,2,Fall 2015,27,0,0,0,0,1&lt;BR /&gt;Male,Total,3,Fall 2015,12,0,0,0,0,1&lt;BR /&gt;Male,Total,5,Fall 2015,7,0,0,0,0,1&lt;BR /&gt;Male,Total,6,Fall 2015,16,0,0,0,0,1&lt;BR /&gt;Male,Total,8,Fall 2015,103,0,0,0,0,1&lt;BR /&gt;Male,Total,9,Fall 2015,4,0,0,0,0,1&lt;BR /&gt;Male,Total,10,Fall 2015,3,0,0,0,0,1&lt;BR /&gt;Male,Total,99,Fall 2015,173,0,0,0,0,0&lt;BR /&gt;Male,Total,99,Fall 2015,173,0,0,1,1,1&lt;BR /&gt;Total,In-state,1,Fall 2015,2,0,0,0,0,1&lt;BR /&gt;Total,In-state,2,Fall 2015,70,0,0,0,0,1&lt;BR /&gt;Total,In-state,3,Fall 2015,28,0,0,0,0,1&lt;BR /&gt;Total,In-state,5,Fall 2015,26,0,0,0,0,1&lt;BR /&gt;Total,In-state,6,Fall 2015,44,0,0,0,0,1&lt;BR /&gt;Total,In-state,8,Fall 2015,317,0,0,0,0,1&lt;BR /&gt;Total,In-state,9,Fall 2015,4,0,0,0,0,1&lt;BR /&gt;Total,In-state,10,Fall 2015,9,0,0,0,0,1&lt;BR /&gt;Total,In-state,99,Fall 2015,500,0,0,0,1,1&lt;BR /&gt;Total,Out-of-state,2,Fall 2015,25,0,0,0,0,1&lt;BR /&gt;Total,Out-of-state,3,Fall 2015,15,0,0,0,0,1&lt;BR /&gt;Total,Out-of-state,5,Fall 2015,7,0,0,0,0,1&lt;BR /&gt;Total,Out-of-state,6,Fall 2015,13,0,0,0,0,1&lt;BR /&gt;Total,Out-of-state,8,Fall 2015,88,0,0,0,0,1&lt;BR /&gt;Total,Out-of-state,9,Fall 2015,13,0,0,0,0,1&lt;BR /&gt;Total,Out-of-state,99,Fall 2015,161,0,0,0,1,1&lt;BR /&gt;Total,Total,1,Fall 2015,2,0,0,0,0,1&lt;BR /&gt;Total,Total,2,Fall 2015,95,0,0,0,0,1&lt;BR /&gt;Total,Total,3,Fall 2015,43,0,0,0,0,1&lt;BR /&gt;Total,Total,5,Fall 2015,33,0,0,0,0,1&lt;BR /&gt;Total,Total,6,Fall 2015,57,0,0,0,0,1&lt;BR /&gt;Total,Total,8,Fall 2015,405,0,0,0,0,1&lt;BR /&gt;Total,Total,9,Fall 2015,17,0,0,0,0,1&lt;BR /&gt;Total,Total,10,Fall 2015,9,0,0,0,0,1&lt;BR /&gt;Total,Total,99,Fall 2015,661,0,0,0,0,0&lt;/P&gt;&lt;P&gt;;&lt;BR /&gt;&lt;BR /&gt;proc report data=all list showall;&lt;BR /&gt;column&lt;BR /&gt;(&lt;BR /&gt;gender lastGender&lt;BR /&gt;residency_desc lastResidency_desc&lt;BR /&gt;lastSchev_ethnicity_desc schev_ethnicity_desc&lt;BR /&gt;academic_period_desc, n);&lt;BR /&gt;define gender / group '';&lt;BR /&gt;define residency_desc / group '';&lt;BR /&gt;define schev_ethnicity_desc / group '' order=internal;&lt;BR /&gt;define lastGender / order order=internal noprint;&lt;BR /&gt;define lastResidency_desc / order order=internal noprint;&lt;BR /&gt;define lastSchev_ethnicity_desc / order order=internal noprint;&lt;BR /&gt;define academic_period_desc / group across '';&lt;BR /&gt;define n / analysis sum '';&lt;BR /&gt;compute after lastResidency_desc / style={background=lightblue};&lt;BR /&gt;x = ' ';&lt;BR /&gt;if lastgender eq 1 then lastResidency_desc=0;&lt;BR /&gt;line x $varying1. lastResidency_desc;&lt;BR /&gt;endcomp;&lt;BR /&gt;compute after gender / style={background=blue};&lt;BR /&gt;line ' ';&lt;BR /&gt;endcomp;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2016 17:48:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/258894#M49968</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2016-03-24T17:48:57Z</dc:date>
    </item>
    <item>
      <title>Re: Compute with If Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/258911#M49978</link>
      <description>&lt;P&gt;Change all the ORDERs to GROUPs. &amp;nbsp;But I think it would be easier to create the LAST variables if you first transpose years to variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=all list;* showall;
   column
      (
         gender lastGender
         residency_desc lastResidency_desc
         lastSchev_ethnicity_desc schev_ethnicity_desc
         academic_period_desc, n
      );
   define gender / group ' ';
   define residency_desc / group ' ';
   define schev_ethnicity_desc / group ' ' order=internal;
   define lastGender / group order=internal noprint;
   define lastResidency_desc / group order=internal noprint;
   define lastSchev_ethnicity_desc / group order=internal noprint;
   define academic_period_desc /  across ' ';
   define n / analysis sum '';
   compute after lastResidency_desc / style={background=lightblue};
      x = ' ';
      if lastgender eq 1 then lastResidency_desc=0;
      line x $varying1. lastResidency_desc;
      endcomp;
   compute after gender / style={background=blue};
      line ' ';
      endcomp;
   run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You're welcome. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2016 18:41:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compute-with-If-Condition/m-p/258911#M49978</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-03-24T18:41:35Z</dc:date>
    </item>
  </channel>
</rss>

