BookmarkSubscribeRSS Feed
Inp
Obsidian | Level 7 Inp
Obsidian | Level 7
Hi Dear,
Here is my coding:
data temp;
input r $2. x $1. y $2. z 1.;
cards;
r1aa11
r1aa21
r1ba11
r1ba21
r2ca11
r2ca22
r2da11
r2da22
r3ee11
;
run;
proc report data=temp nowd nocenter;
column r x y z;
define r / group;
define x / group;
define y / 'y';
define z / analysis;

break after x/summarize DOL DUL ;
break after r /summarize DOL DUL ;
rbreak after / summarize DOL DUL ;
run;

How do I get the expeced below output:

r x y z
r1 a a1 1
a2 1
== = =========
r1 a 2
== = =========
b a1 1
a2 1
== = =========
r1 b 2
== = =========
== =========
r1 4
== =========
r2 c a1 1
a2 2
== = =========
r2 c 3
== = =========
d a1 1
a2 2
== = =========
r2 d 3
== = =========
== =========
r2 6
== =========
r3 e e1 1
== = =========
=========
11
=========

but I am getting the below

r x y z
r1 a a1 1
a2 1
== = =========
r1 a 2
== = =========
b a1 1
a2 1
== = =========
r1 b 2
== = =========
== =========
r1 4
== =========
r2 c a1 1
a2 2
== = =========
r2 c 3
== = =========
d a1 1
a2 2
== = =========
r2 d 3
== = =========
== =========
r2 6
== =========
r3 e e1 1
== = =========
r3 e 1
== = =========
== =========
r3 1
== =========
=========
11
=========

I don't want repeat r3 three times. I need this to appear only one time in the report
Thanks so much for help in advance.

Thanks

Inp
2 REPLIES 2
Cynthia_sas
SAS Super FREQ
Hi
Even though R3 only has one row you have asked for multiple summaries with the BREAK statement for X and R. PROC REPORT summarizes EVERY group, no matter whether there is one observation in a group or 1000 observations in a group ( as described in the doc)
http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a002473623.htm

Are you seeing any warning messages in the Log???

What is the usage of Y variable??? DISPLAY, ORDER or GROUP??

You may want PROC report to perform processing that it is unable to perform.

Cynthia
Cynthia_sas
SAS Super FREQ
Hi:
A followup...PROC REPORT is doing exactly what you tell it to do. If you compare the output for R=R1 versus R=R3, you will see that you are getting exactly the same output for both groups. PROC REPORT does not care whether the group has 1 detail row or 1000 detail rows. See the annotated output below:
[pre]
r x y z
r1 a a1 1 <-- detail line for a1 X=a
a2 1 <-- detail line for a2 X=a
== = =========
r1 a 2 <-- break after X=a
== = =========
b a1 1 <-- detail line for a1 X=b
a2 1 <-- detail line for a2 X=b
== = =========
r1 b 2 <-- break after X=b
== = =========
== =========
r1 4 <-- break after R
== =========



r3 e e1 1 <-- detail line for e1 X=e
== = =========
r3 e 1 <-- break after X=e
== = =========
== =========
r3 1 <-- break after R
== =========

=========
11 <-- summary from RBREAK statement
=========
[/pre]

As you can see, when R=R1, there are detail lines and summary lines, placed by the BREAK AFTER X and BREAK AFTER R. And with R=R3, even though you only have 1 detail line, you see the detail line, followed by the same summary lines which were produced for R=R1 (or R=R2 -- R2 not shown here to save space).

PROC REPORT will not treat the group for R3 any differently than it treats the groups for R1 or R2. So, PROC REPORT is giving you the only results that it can give you -- expecting anything different from PROC REPORT is unrealistic and contrary to the way that PROC REPORT has always worked.

cynthia

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 621 views
  • 0 likes
  • 2 in conversation