BookmarkSubscribeRSS Feed
yaakov555
Fluorite | Level 6

How do I make a non tabular report using Proc Report?

12 REPLIES 12
ballardw
Super User

Define what a "non-tabular report" would be.

Perhaps include a small example data or use of the SAS supplied data set such as Sashelp.class and show what the result is supposed to be.

 

 

pink_poodle
Barite | Level 11
You mean without the grid lines? There are various styles you can use. Please check out this gallery:
https://sassavvy.com/proc_report_gallery.html/
yaakov555
Fluorite | Level 6

Yes how do I get rid of the grid lines?

Reeza
Super User
Display of a report is controlled by both the STYLE default and the settings in proc report.

Look at the different SAS styles and consider changing your ODS STYLE as a starting point. Look at the Journal Style for a very basic style.

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/odsadvug/p14qidvs5xf7omn14ommvsuhvmzn.htm#p1m...
yaakov555
Fluorite | Level 6

I would like it the way proc report used to do it, without any grid.

Reeza
Super User

SASDocPrinter Style is the one you want, I suspect. It's in the list I previously linked to.

 

ods pdf file='/home/fkhurshed/Demo1/pdf_example.pdf' style=sasdocprinter;

proc report data=sashelp.class;
run;

ods pdf close;
yaakov555
Fluorite | Level 6

Is it not possible to create a report without any grid?

Reeza
Super User

Yes, but you may need to specify how. 

Tom
Super User Tom
Super User

@yaakov555 wrote:

Is it not possible to create a report without any grid?


Sure it is.  What did you TRY?

Why not just make them "invisible" by using the same color as the background?

proc report data=sashelp.class 
  style(column)=[bordercolor=white] 
  style(header)=[bordercolor=white] 
;
run;
yaakov555
Fluorite | Level 6

This is better but I am still not there

yaakov555
Fluorite | Level 6

Hi,

This is my code

libname dat1 '~/Clinical';

%macro report(var);
Proc freq data=dat1.adsl noprint ;
tables &var*arm/ out=fsl;
Proc freq data=dat1.adsl noprint ;
tables &var/out=fsl2;
run;
data dsl;
set fsl fsl2(in=inb);
where percent ne .;
pct=cats('(',put(percent/100, percent7.2),')');
comb=catx(' ', count, pct);
if inb then
arm='Total';
run;
proc sort data=dsl out=dsl;
by &var;
run;
options validvarname=v7;
proc transpose data=dsl out=&var;
by &var;
var comb;
id arm;
run;
%mend report;

%report(sex)
%report(ethnic)
%report(race)
%report(agegr1)

data sex1;
set sex;
Array arm[8] GT0918_50_mg_day GT0918_100_mg_day GT0918_200_mg_day
GT0918_300_mg_day GT0918_400_mg_day GT0918_500_mg_day GT0918_600_mg_day total;
do i=1 to 8;
arm[i]=cats('N=',substr(arm[i],1,2));
end;
data sex;
set sex1 sex;
run;
Proc means data=dat1.adsl noprint;
var age;
class arm;
output out=arm;
format age 4.1;
run;
Proc means data=dat1.adsl noprint Median;
var age;
class arm;
output out=arm1 Median=median;
format age 4.1;
run;
data arm;
set arm arm1(rename=(median=age)) ;
by arm;
if _stat_='' then _stat_='MEDIAN';
if arm=' ' then
arm='Total';
run;
proc sort data=arm;
by _stat_;
Proc transpose data=arm out=age;
by _stat_;
var age;
id arm;
run;
data age(drop=Total GT0918_600_mg_day GT0918_500_mg_day GT0918_50_mg_day
GT0918_400_mg_day GT0918_300_mg_day GT0918_200_mg_day GT0918_100_mg_day);
set age;
total1=put(total, 5.1);
g_100=put(GT0918_100_mg_day, 5.1);
g_200=put(GT0918_200_mg_day, 5.1);
g_300=put(GT0918_300_mg_day, 5.1);
g_400=put(GT0918_400_mg_day, 5.1);
g_50=put(GT0918_50_mg_day, 5.1);
g_500=put(GT0918_500_mg_day, 5.1);
g_600=put(GT0918_600_mg_day, 5.1);
run;
data rep(drop=_name_ sex ethnic race agegr1 i);
length Parameter $25 Category $25 sex $4;
set sex ethnic race age(rename=(total1=total g_100=GT0918_100_mg_day
g_200=GT0918_200_mg_day g_300=GT0918_300_mg_day g_400=GT0918_400_mg_day
g_50=GT0918_50_mg_day g_500=GT0918_500_mg_day g_600=GT0918_600_mg_day
_label_=Parameter _stat_=Category)) agegr1;
Array arm[7] GT0918_50_mg_day GT0918_100_mg_day GT0918_200_mg_day
GT0918_300_mg_day GT0918_400_mg_day GT0918_500_mg_day GT0918_600_mg_day;
do i=1 to 7;
if arm[i]=' ' then
arm[i]='0 (0.00%)';
end;
if sex='M' then
sex='Male';
if sex ='Male' and _n_>1 then
do;
Parameter='Sex';
Category=sex;
end;
if ethnic ne ' ' then
do;
Parameter='Ethnicity';
Category=ethnic;
end;
if race ne ' ' then
do;
Parameter='Race';
Category=race;
end;
if agegr1 ne ' ' then
do;
Parameter='Age Group (Years)';
Category=agegr1;
end;
if Parameter='Age' then
Parameter='Age (Years)';
run;
Title 'Table 12.1.2.1.1';
Title2 'Demographic Characteristics';
Title3 'Safety Analysis Set';
proc report data=rep split='~' missing ;
columns (Parameter Category ('Escalation Cohort' GT0918_50_mg_day GT0918_100_mg_day
GT0918_200_mg_day GT0918_300_mg_day GT0918_400_mg_day
GT0918_500_mg_day GT0918_600_mg_day)('Total' Total));
Define Parameter/group order=data 'Parameter' ;
Define Category/group 'Category/~Statistic' left;
Define GT0918_50_mg_day / 'GT0918~50 mg/day' center ;
Define GT0918_100_mg_day/ 'GT0918~100 mg/day' center;
Define GT0918_200_mg_day/ 'GT0918~200 mg/day' center;
Define GT0918_300_mg_day/ 'GT0918~300 mg/day' center;
Define GT0918_400_mg_day/ 'GT0918~400 mg/day' center;
Define GT0918_500_mg_day/ 'GT0918~500 mg/day' center;
Define GT0918_600_mg_day/ 'GT0918~600 mg/day' center;
Define Total/'' center;
compute after Parameter;
line ' ';
Endcomp;
run;

 

In the output window the results are in tabular format and the headings appear in blue. I need to get rid of all that.

FYI: I am using SAS Studio.

Cynthia_sas
SAS Super FREQ

Hi:

  Your code needs to take full control of the ODS destination. It looks like you are using the default ODS HTML destination. Most of the demographic reports like this that I see are created for RTF and/or PDF output, not HTML. but in any case, you need full control so that you can control the destination and the style being used. In addition, I used some simple ODS style overrides in the PROC REPORT code to turn off the grid lines. Rather than run your code over and over again, I just made a CSV file for WORK.REP and used that. Changes to your code are highlighted in yellow:

Cynthia_sas_1-1660522655513.png

All the output is shown below:

Cynthia_sas_2-1660522704682.png

Cynthia

 

SAS Innovate 2025: Call for Content

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!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 12 replies
  • 1477 views
  • 2 likes
  • 6 in conversation