<?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: How to deduct 1 from observations in PROC REPORT in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257235#M18013</link>
    <description>i think this works like ur sample code:&lt;BR /&gt;compute obs;&lt;BR /&gt;if _break_ ne '_RBREAK_' then dsobs +1;&lt;BR /&gt;obs=dsobs;&lt;BR /&gt;endcomp;</description>
    <pubDate>Thu, 17 Mar 2016 08:56:21 GMT</pubDate>
    <dc:creator>imdickson</dc:creator>
    <dc:date>2016-03-17T08:56:21Z</dc:date>
    <item>
      <title>How to deduct 1 from observations in PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257224#M18007</link>
      <description>&lt;P&gt;Hello, Im using SAS EG to do PROC REPORT.&lt;/P&gt;&lt;P&gt;I have a problem here. I have managed to add Obs into PROC REPORT however, the Obs appears until the very last row of the table which is already at the SUM/TOTAL row. I want my obs up to the last row before SUM. Is there a way to do so?&lt;/P&gt;&lt;P&gt;&lt;IMG title="PROC PRINT OBS.jpg" border="0" alt="PROC PRINT OBS.jpg" src="https://communities.sas.com/t5/image/serverpage/image-id/2343iA3869F0C7BFD26D5/image-size/original?v=mpbl-1&amp;amp;px=-1" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=WORK.JOIN2BCAE;
COL obs X_BCAE_NAME X_BCAE_POSITION X_BCAE_INCOME X_BCAE_CARLOAN X_BCAE_MORTGAGE X_BCAE_CASHFLOW /*newsum*/ newcompute;

define obs / computed "No.";
define X_BCAE_NAME / display "Name";
define X_BCAE_POSITION / display "Position";
define X_BCAE_INCOME / sum "Income";
define X_BCAE_CARLOAN / order sum "Car Loan";
define X_BCAE_MORTGAGE / analysis "Mortgage";
define X_BCAE_CASHFLOW / analysis "Cash Flow";
define newcompute / computed "Maximum New Loan";
compute newcompute;
newcompute=X_BCAE_INCOME.sum-X_BCAE_CARLOAN.sum-X_BCAE_MORTGAGE.sum-1500;
ENDCOMP;
compute obs;
dsobs +1;
obs=dsobs;
endcomp;
/*compute CARLOAN;*/
/*CARLOAN=CARLOAN.SUM;*/
/*ENDCOMP;*/


/*compute X_BCAE_POSITION; */
/*if _break_ ne ' ' then call define('age','style','style=[pretext="total"]'); */
/*endcomp; */

compute after;
       X_BCAE_POSITION='TOTALS:';
    endcomp;
	rbreak after  /skip summarize dol dul;

RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2016 07:40:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257224#M18007</guid>
      <dc:creator>imdickson</dc:creator>
      <dc:date>2016-03-17T07:40:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to deduct 1 from observations in PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257230#M18008</link>
      <description>&lt;P&gt;Add the observation number to the dataset in a previous step, and use it with type "display" in proc report. This keeps it from appearing in the summary line.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2016 08:13:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257230#M18008</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-03-17T08:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to deduct 1 from observations in PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257231#M18009</link>
      <description>&lt;P&gt;Hi Kurt, u mean before compute, do 1 datastep to store the number of records? for example 1 to 9 if my records has 9 rows?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2016 08:16:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257231#M18009</guid>
      <dc:creator>imdickson</dc:creator>
      <dc:date>2016-03-17T08:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to deduct 1 from observations in PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257232#M18010</link>
      <description>&lt;P&gt;Yes. Make sure that the dataset already has the correct order, and then do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data xxx;
set xxx;
obs = _N_;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Mar 2016 08:18:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257232#M18010</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-03-17T08:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to deduct 1 from observations in PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257233#M18011</link>
      <description>just to ask again, this datastep is outside PROC REPORT or within PROC REPORT? because if i put in PROC REPORT, all my compute shows red color and error....</description>
      <pubDate>Thu, 17 Mar 2016 08:22:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257233#M18011</guid>
      <dc:creator>imdickson</dc:creator>
      <dc:date>2016-03-17T08:22:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to deduct 1 from observations in PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257234#M18012</link>
      <description>&lt;P&gt;The data step would have to happen separately before proc report.&lt;/P&gt;
&lt;P&gt;But I found a better way:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;compute obs;
dsobs + 1;
if _break_ ne ' ' then call define('obs','style','style=[pretext=""]'); else obs = put(dsobs,best.);
endcomp;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Mar 2016 08:31:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257234#M18012</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-03-17T08:31:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to deduct 1 from observations in PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257235#M18013</link>
      <description>i think this works like ur sample code:&lt;BR /&gt;compute obs;&lt;BR /&gt;if _break_ ne '_RBREAK_' then dsobs +1;&lt;BR /&gt;obs=dsobs;&lt;BR /&gt;endcomp;</description>
      <pubDate>Thu, 17 Mar 2016 08:56:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257235#M18013</guid>
      <dc:creator>imdickson</dc:creator>
      <dc:date>2016-03-17T08:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to deduct 1 from observations in PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257237#M18014</link>
      <description>&lt;P&gt;In my test&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=sashelp.class;
col obs name weight;
define obs / computed "No.";
define name / display 'Name';
define weight / analysis 'Weight';
compute obs;
if _break_ ne '_RBREAK_' then dsobs +1;
obs=dsobs;
endcomp;
rbreak after /summarize;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;this only prevented the increment, but still displayed the number of the previous step&lt;/P&gt;
&lt;P&gt;This worked better:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;compute obs;
if _break_ ne '_RBREAK_' then do;
  dsobs +1;
  obs=dsobs;
end;
endcomp;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I think this is the most elegant (bc. simple) solution.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2016 09:20:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257237#M18014</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-03-17T09:20:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to deduct 1 from observations in PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257239#M18015</link>
      <description>Hi Kurt, however, in the results, there is a .(which indicates a null) in the TOTAL/SUM row. Any idea on how to eliminate that?</description>
      <pubDate>Thu, 17 Mar 2016 09:25:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257239#M18015</guid>
      <dc:creator>imdickson</dc:creator>
      <dc:date>2016-03-17T09:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to deduct 1 from observations in PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257241#M18016</link>
      <description>&lt;P&gt;Not tested. This could worked ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;options missing=' ';&lt;BR /&gt;................&lt;BR /&gt;compute after;
       X_BCAE_POSITION='TOTALS:';
obs=. ;
endcomp;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Mar 2016 09:31:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257241#M18016</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-03-17T09:31:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to deduct 1 from observations in PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257245#M18017</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/63520"&gt;@imdickson&lt;/a&gt; wrote:&lt;BR /&gt;Hi Kurt, however, in the results, there is a .(which indicates a null) in the TOTAL/SUM row. Any idea on how to eliminate that?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Ah, I had options missing = ' '; active.&lt;/P&gt;
&lt;P&gt;Add&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options missing = ' ';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;before the proc report.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2016 09:45:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257245#M18017</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-03-17T09:45:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to deduct 1 from observations in PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257247#M18018</link>
      <description>where exactly do i put this options missing=' '; ?</description>
      <pubDate>Thu, 17 Mar 2016 09:57:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257247#M18018</guid>
      <dc:creator>imdickson</dc:creator>
      <dc:date>2016-03-17T09:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to deduct 1 from observations in PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257248#M18019</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/63520"&gt;@imdickson&lt;/a&gt; wrote:&lt;BR /&gt;where exactly do i put this options missing=' '; ?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Where I stated in my previous post.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2016 09:59:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257248#M18019</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-03-17T09:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to deduct 1 from observations in PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257488#M18031</link>
      <description>&lt;P&gt;At the start of your code. It is system option.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2016 00:55:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-deduct-1-from-observations-in-PROC-REPORT/m-p/257488#M18031</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-03-18T00:55:45Z</dc:date>
    </item>
  </channel>
</rss>

