<?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: can a computed variable be made to span rows in proc report? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/can-a-computed-variable-be-made-to-span-rows-in-proc-report/m-p/677670#M204436</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;Thank you so very much. The check is in the mail &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Aug 2020 01:14:13 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2020-08-19T01:14:13Z</dc:date>
    <item>
      <title>can a computed variable be made to span rows in proc report?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-a-computed-variable-be-made-to-span-rows-in-proc-report/m-p/677617#M204417</link>
      <description>&lt;P&gt;I have a dataset with identifiers that I do not want in the final report.&lt;/P&gt;&lt;P&gt;For example, it is generated from this code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one;
	array idarr{10} $ idarr1-idarr10 ('a','b','c','d','e','f','g','h','i','j');
	do a=1 to 10;
		iden=idarr[a];
		do b=1 to 3;
			do c=1 to 2;
				output;
			end;
		end;
	end;
	drop a;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Using the following, the variables span as I would like&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=one spanrows;
	columns iden b c;
	define iden	/ 'id' order order=internal;
	define b	/ 'B' order order=internal;
	define c	/ 'C' order order=internal;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I do not want the "iden" variable to be in the report, but want a counter [that increments with each change of iden] instead, I wrote the following:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=one spanrows;
	columns iden nobs3 b c;
	define iden		/ 'id' order order=internal;
	define nobs3	/ 'id obs 3' computed;
	define b		/ 'B' order order=internal;
	define c		/ 'C' order order=internal;

	compute nobs3;
		if not missing(iden) then dsobs3+1;
		nobs3=dsobs3;	
	endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;the problem is nobs3 is repeated for every row.&lt;/P&gt;&lt;P&gt;Is there a way to make the computed variable nobs3 span in the same way iden does?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One way I know to make it work is to create nobs3 in the dataset that is being passed to report, but, if possible, I was hoping to create it within report.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Aug 2020 19:49:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-a-computed-variable-be-made-to-span-rows-in-proc-report/m-p/677617#M204417</guid>
      <dc:creator>jtcowder</dc:creator>
      <dc:date>2020-08-18T19:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: can a computed variable be made to span rows in proc report?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-a-computed-variable-be-made-to-span-rows-in-proc-report/m-p/677628#M204423</link>
      <description>&lt;P&gt;Why not use a format?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table _F as
  select START, monotonic() as LABEL, '$iden' as FMTNAME, 'C' as TYPE
  from (select unique IDEN as START from ONE);
proc format cntlin=_F; run;

proc report data=ONE spanrows;
	columns IDEN B C;
	define IDEN / 'id' order order=internal format=$iden.;
	define B	/ 'B' order order=internal;
	define C	/ 'C' order order=internal;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Aug 2020 20:09:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-a-computed-variable-be-made-to-span-rows-in-proc-report/m-p/677628#M204423</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-08-18T20:09:17Z</dc:date>
    </item>
    <item>
      <title>Re: can a computed variable be made to span rows in proc report?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-a-computed-variable-be-made-to-span-rows-in-proc-report/m-p/677631#M204425</link>
      <description>&lt;P&gt;That certainly works, I would not have thought of that.&lt;/P&gt;&lt;P&gt;Thank you for the suggestion, it is much appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Aug 2020 20:20:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-a-computed-variable-be-made-to-span-rows-in-proc-report/m-p/677631#M204425</guid>
      <dc:creator>jtcowder</dc:creator>
      <dc:date>2020-08-18T20:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: can a computed variable be made to span rows in proc report?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-a-computed-variable-be-made-to-span-rows-in-proc-report/m-p/677641#M204428</link>
      <description>&lt;P&gt;Sir&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp; priceless solution. Jealous of how you think. I don't like you sorry.lol. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Brings me to ground zero and tears that kind of thought/application would ever strike my mind. Well done!&lt;/P&gt;</description>
      <pubDate>Tue, 18 Aug 2020 20:55:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-a-computed-variable-be-made-to-span-rows-in-proc-report/m-p/677641#M204428</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-08-18T20:55:42Z</dc:date>
    </item>
    <item>
      <title>Re: can a computed variable be made to span rows in proc report?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-a-computed-variable-be-made-to-span-rows-in-proc-report/m-p/677670#M204436</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;Thank you so very much. The check is in the mail &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 01:14:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-a-computed-variable-be-made-to-span-rows-in-proc-report/m-p/677670#M204436</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-08-19T01:14:13Z</dc:date>
    </item>
  </channel>
</rss>

