dear all,
Please find the attachments of DM dataset and data set report output model
i have written code as below however i am not able to insert variable 'Treatment sequence"as across all treatments and also need to rename variable "Min_max " to "Max,Min" to display in report
can any one help to generate same report...........
ods listing close;
options orientation=landscape ;
proc report data= mer1 headskip spacing=1 split='/' missing nowd
style(header) = [just=center] ;
column category _name_ treatment( a b c d overall) ;
define treatment/across style(header)=[just=center];
define category /display style (header)=[just=left] style(column)=[just=left cellwidth=14%];
define _name_ / " Statistic" style(header) = [just = left]
style(column)= [just = left
cellwidth = 15%] ;
define a / "Treatment A/Standard fat: " style(header) = [just = left]
style(column)= [cellwidth = 14%];
define b / " Treatment B:/Low-fat" style(header) = [just = left]
style(column)= [cellwidth = 14%];
define c / "Treatment C:/High-fat " style(header) = [just = left]
style(column)= [cellwidth = 14%];
define d / "Treatment D:/Fasting " style(header) = [just = left]
style(column)= [cellwidth = 14%];
define overall/ "Overall " style(header) = [just = left]
style(column)= [cellwidth = 14%];
;
run;
ods rtf close;
ods listing;
Hi:
Are you sure that your posted code creates the desired results? Usually, when you have an ACROSS item, you need a comma (,) in the COLUMN statement. So it looks to me like your TREATMENT variable is not being used or crossed with what's in the parentheses.
column category _name_ treatment,(a b c d overall); /* note difference between my COLUMN statement and what you posted. You do not have a , after TREATMENT)
Also, you say that "also need to rename variable "Min_max " to "Max,Min" to display in report", but I do NOT see an item called Min_max in your COLUMN statement:
column category _name_ treatment( a b c d overall) ; |
Just curious you might mean that you want to change the value for ONE of the rows underneath _NAME_???? You could do this in a DATA step program or you could do this with a COMPUTE block for _NAME_.
Generally, if you wanted a "spanning" column header above a b c d and overall, you would do something like this:
column category _name_ ('Some Long String' treatment,(a b c d overall));
OR, you would change the label for TREATMENT in the DEFINE statement like:
define treatment/across style(header)=[just=center] 'A Different Long String';
And, I guess you didn't post complete data because your DM dataset does not have a variable called TREATMENT so a test PROC REPORT step failed because TREATMENT not found. I notice that your PROC REPORT uses WORK.MER1 and NOT the DM dataset that you attached to the posting.
In addition, you indicate that you are interested in ODS RTF, but options like HEADSKIP and SPACING are ignored for ODS RTF. And, you didn't post your ODS RTF beginning statement so we could see what other options you might have specified for ODS RTF, like the STYLE= option. Looks like STYLE=JOURNAL, but hard to know since you might have created your own custom STYLE.
cynthia
Hi ,
Thanks for providing useful information ,
as per comment u have been given for Treatment variable should be in data set ? however is any way to create that variable in proc report only
want create new Treatment Variable in proc report and same will use to header
and also want show all border lines show in report include outer and inner lines for rows and columns
i hope u have understand my scenario
Regards,
Rajasekahr Reddy
Hi:
ACROSS items can't be computed. So they have to exist before the PROC REPORT starts. The fact that TREATMENT wasn't in your data was one of the reasons I was of the thinking that your posted code might not have produced the output you posted.
Since you did NOT show your ODS RTF statement and you want to show all the border lines in your report, I would recommend using the default RTF style -- something like:
ODS RTF file='test_report.rtf' style=RTF;
Did you experiment with the spanning header technique I showed without creating a TREATMENT variable to see how that might work for you. You do NOT need a TREATMENT variable to make a spanning header.
column category _name_ ('Some Long String' (a b c d overall));
To do what you want with Min_Max then you need to use a COMPUTE block with an IF statement or you need to pre-process the data for PROC REPORT and change the value before you send the data to PROC REPORT.
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.