Hallo All,
I have the dataset :
But I want to use PROC REPORT and The LINE statement.
I want to have before the KW the values of KW , Test1 and Test2 in the report.
Can anyone know how to get this Report? Any help would be greatly appreciated.
Many Thanks,
Hi:
If the OP is using Test1 and Test2 in the extra line before each group, I am wondering whether NOPRINT would be more the type of look wanted on the report.
cynthia
Hi:
What code have you tried? Have you looked at using a COMPUTE/ENDCOMP block with a LINE statement. A COMPUTE BEFORE should get you most of what you need. I am confused a bit by your picture of what you want -- the results for Test1 and Test2 appear on every row on the report and they are the same on every row in your example. Are they ALWAYS the same on every report row???
cynthia
I agree, its not clear. Why not have the additional bit as a by line and not have it in the report body.
hi
I agree with Cynthia about what results to display.
To get you started with COMPUTE blocks, here is a sample program that gets you close to what you want. There is no coloring, this can be achieved using Inline Formatting
Hi:
If the OP is using Test1 and Test2 in the extra line before each group, I am wondering whether NOPRINT would be more the type of look wanted on the report.
cynthia
yes, I tried with COMPUTE/ENDCOMP block with a LINE statement but, I didn't find the result. But now I have it.
define KW / order order=data;
define Test1 /noprint analysis mean;
define Test2 /noprint analysis mean;
compute before KW;
line @20 'calender-week ='
@35 KW1 $5.
@100 'Test1-Result ='
@123 Test1.mean 5.
@180 'Test2-Result ='
@198 Test2.mean 5. ;
endcomp;
I change the DEFINE Test1 / display with DEFINE Test1 / analysis mean. Now its ok.
Thank you all for your help!
Hi: the @20, @35 will only work in the LISTING destination, but will not work in ODS HTML or other ODS destination where you also want to use STYLES. So, you can't use that technique and still get the colors you want. Here's the code I used to take that screen shot. It is a variation of the code that Bruno used. The difference between my code and his code, is that I break at a different place, assuming that TEST1 and TEST2 are always the same for every value of KW.
Cynthia
ods html file='c:\temp\testreport.html';
proc report data=test nowd
style(header)={background=yellow};
column KW Test1 Test2 Test3 Test4 Test5;
define KW / order style(column)={background=yellow};
define Test1 / order noprint;
define Test2 / order noprint;
define test3 / display;
define test4 /display;
define test5 / display;
compute before test2 / style={just=l background=orange font_weight=bold};
line 'Calendar week: ' KW $5. ' Test 1: ' Test1 3.0 ' Test2: ' Test2 3.0;
endcomp;
run;
ods html close;
Cynthia ,
I don't think so. The following worked in HTML and RTF destination .
proc report data=sashelp.class nowd;
column sex name weight;
define sex/order;
define name/display;
define weight/display;
compute after sex/style(lines)={asis=on};
line @4 'xxx' @40 'yyy';
endcomp;
run;
Xia Keshan
Hi:
I think it looks better in the RTF output than in the HTML. HTML might have a faint gray outline/box around what's written with the LINE command. So even though it sort of works, I don't count on it.
cynthia
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.