Newproc report

Reply
New Contributor
Posts: 2

Newproc report

Has anyone used this new enhanced proc report?

i have tried using it but to no avail Smiley Sad
SAS Super FREQ
Posts: 8,645

Re: Newproc report

Do you mean the Proc Report that's been around since SAS 6? Or do you mean some other report procedure? Just curious which "new" proc report you mean.
cynthia
N/A
Posts: 0

how to find by use report

HI,
i was problem my data like this.

v1 v2 v3 v4 v5
a k m 2 3
a j l 3 7
b h m 9 5
b g l 5 3

but i want output like this

v1
v2 v4 v5
a 05 10
m 02 03
l 03 07

k 05 10
m 02 03
l 03 07

k 05 10
m 02 03
l 03 07

b 14 08
m 09 05
l 05 03

h 14 08
m 09 05
l 05 03

g 14 08
m 09 05
l 05 03



please send me using proc report.

Thanku advance.
SAS Super FREQ
Posts: 8,645

Re: how to find by use report

Hi...it's a bit hard for me to understand what you want from PROC REPORT, since your data does not correspond to the desired output that you show.

If I understand you correctly, you have 5 variables named v1, v2, v3, v4 and v5 and in a table, they look like this: [pre]
v1 v2 v3 v4 v5
a k m 2 3
a j l 3 7
b h m 9 5
b g l 5 3
[/pre]

and, then what you want is something like this (shortened):[pre]
v1
v2 v4 v5
a 05 10
m 02 03
l 03 07
[/pre]


If I look at your data, v1 only has possible values of 'a' or 'b'; while v2 has possible values of 'k', 'j', 'h' or 'g' and v3 has possible values of 'm' or 'l'.

So I'm not sure which variables you're showing in the first column. You have v1 stacked on top of v2, but you show values of 'a', 'm' and 'l' in the 1st column, which are NOT in v2 values at all. It seems to me that you are showing v1 values stacked on top of v3 values.

With the above data, in a SAS dataset called "testdata", if I run this PROC REPORT code, [pre]

proc report data=testdata nowd;
column v1 v4 v5;
define v1/ group;
define v4 /sum;
define v5 /sum;
rbreak after /summarize dol dul;
run;
[/pre]
then this is what I see in the LISTING window:
[pre]
v1 v4 v5
a 5 10
b 14 8
========= =========
19 18
========= =========
[/pre]

If I add v3 into the COLUMN statement [pre]
ods listing;
proc report data=testdata nowd;
column v1 v3 v4 v5;
define v1/ group;
define v3 /group;
define v4 /sum;
define v5 /sum;
break after v1/ summarize skip ol ul;
run;
[/pre]
Then, THIS is what I see in the LISTING window:
[pre]

v1 v3 v4 v5
a l 3 7
m 2 3
-------- --------- ---------
a 5 10
-------- --------- ---------

b l 5 3
m 9 5
-------- --------- ---------
b 14 8
-------- --------- ---------
[/pre]

If what you want is for the summary line for A to be
ABOVE the group, so that the summary appears before, that is also possible, but the PROC REPORT code is a bit trickier. This code: [pre]
ods listing;
proc report data=testdata nowd headline;
column v1 v3 v4 v5;
define v1/ group noprint;
define v3 /group "V3/Values/For V1";
define v4 /sum "V4";
define v5 /sum "V5";
compute v3;
if _BREAK_ = 'v1' then do;
tmp = upcase(trim(v1)) ||' Total';
v3 = tmp;
end;
endcomp;
break before v1/ summarize ;
break after v1 /skip;
run;
[/pre]
will get you this output in the LISTING window:[pre]
V3
Values
For V1 V4 V5
------------------------------
A Total 5 10
l 3 7
m 2 3

B Total 14 8
l 5 3
m 9 5
[/pre]

My output assumes that v1, v2, and v3 are all character variables with a length of at least $8. Essentially what this last program is doing is putting the summary for V1 ABOVE or BEFORE the breakdown of V3 values. This is fine, but to avoid having an extra column for V1 in the table, you then have to test the special variable _BREAK_ in order to rename V3 appropriately at the BREAK, ONLY when the summary line is written. In order to make clear that this was a summary line based on V1 values, I added the word "Total" to the value for V1.

If this is NOT what you wanted with the data that you showed or if you need a bit more help with PROC REPORT code, there is an excellent section in the SAS on-line help files on how PROC REPORT constructs a report and it talks about using NOPRINT and COMPUTE blocks and the _BREAK_ variable.

In addition, there is a new book, by Art Carpenter that is soon to be published by SAS Press, that will cover PROC REPORT. And, as always, the Tech Support folks can help you get started with other PROC REPORT help.

Good luck!
cynthia
New Contributor
Posts: 2

Re: Newproc report

Nope this seems to be a new one, there is a sugi paper that outlines the new proc report.

http://www2.sas.com/proceedings/sugi24/Posters/p219-24.pdf
SAS Super FREQ
Posts: 8,645

Re: Newproc report

The person who wrote that SUGI paper states in the paper that:
"PROCEDURE SHIPMENT
The enhanced report procedure can be shipped as a separate module, it can be installed into your SAS System, once installed there is no need to run any programs before using the procedure." It looks to me (from the % in his "NEWPROC REPORT" code that he is using some kind of macro invocation or user written module to operate in a similar fashion to PROC REPORT, but it doesn't seem to be a SAS-supported procedure. You might consider contacting the author of the paper to find out more about the module.

But, before you do, something to consider is that SUGI 24 was 7 years ago, in 1999. That was just as the Output Delivery System was introduced. The person who wrote the paper you reference was producing all of their output in the LISTING window. Since that paper was written, it is now possible to have PROC REPORT calculate the MEDIAN statistic. In addition, the BOX option inside PROC REPORT -- has been made somewhat obsolete by the ability to control the interior table lines using the Output Delivery System. (In the paper, the author says that MEDIAN and the BOX option are two of the reasons that he wrote his own version of PROC REPORT.)

By SUGI 28, he had written a different macro program to format tabular output:
http://www2.sas.com/proceedings/sugi28/224-28.pdf and by SUGI 29, he was writing about performing clinical trials, using SAS/AF to generate front-end menus:
http://www2.sas.com/proceedings/sugi29/151-29.pdf

Now that you can use ODS to create your tabular output, many people in the Pharmaceutical industry are using PROC REPORT and/or DATA _NULL_ programs to generate the kind of report illustrated in his SUGI paper.

At any rate, to reproduce the report in his SUGI paper from SUGI 24 is fairly easy with "regular" PROC REPORT. Consider this program. (I used SASHELP.CLASS, but increased the age several times to get more obs in the file for PROC REPORT.)[pre]
data morekids;
set sashelp.class;
output;
age= age + 5;
output;
age = age + 5;
output;
run;

proc format;
value agefmt low-14 = '14 and under'
15-20 = '15 to 20'
21-high = '21 and over';
value $gfmt 'F' = 'Female'
'M' = 'Male';
run;

options nodate nonumber;
ods html file='c:\temp\demo.html' style=sasweb;
ods rtf file='c:\temp\demo.rtf' ;

proc report data=morekids nowd
style(header)={background=_undef_};
Title "Table 4: Summary of Patient's Height Information";
column age sex,(height height=hmed height=hmin height=hmax);
define age /group f=agefmt.
style(column)={just=left};
define sex /across ' ' f=$gfmt.;
define height / mean "Mean" f=6.2;
define hmed / median 'Median' f=6.2;
define hmin / min 'Min' f=6.2;
define hmax /max 'Max' f=6.2;
run;
ods html close;
ods rtf close;
[/pre]

Tech Support can help you figure out the best way to use PROC REPORT to generate the report you want. In addition, SAS Education offers a class that covers PROC REPORT, PROC TABULATE and ODS, in Live Web and classroom format. For more information about the classes:
http://www.sas.com/apps/wtraining2/coursedetails.jsp?course_code=odsir9&ctry=us

cynthia
Post a Question
Discussion Stats
  • 5 replies
  • 479 views
  • 0 likes
  • 3 in conversation