BookmarkSubscribeRSS Feed
Skyez
Calcite | Level 5

Hi.

I need to create with the report like this. And I used multiple proc report to generate different reports, but now I want to concentrate them together to get the following result. What should I do? I need to output the PDF file.

Skyez_0-1688009027367.png

Here is my code:

ods pdf file='/home/u6341199/sasuser.v94/Program1/report.pdf' startpage=no;
proc report data=program1.summarydaat2 nofs split='*' headline headskip; ;
  title1 "Demographic and baseline summary";
  title2 'All Randomized subjects';
  column AGE  DRUGA PLACEBO_ row_sum ;
  define AGE / group width=6 '' order;
  define DRUGA / "DRUG A*&agestr" format=comma10.2;
  define PLACEBO_ / "PLACEBO*&htstr" format=comma10.2;
  define row_sum/ computed format=comma10.2 "Total*&wtstr";
  break after age / ol skip suppress;
  compute before ;
 line @1 'Age';
endcomp;
  compute row_sum;
  row_sum = sum(_C2_,_C3_);
  endcompute;
 run; 

proc report data=program1.race_4 nofs split='*' headline headskip;
column Category DRUGA PLACEBO_ row_sum ;
define Category / group width=15 '' order;
  define DRUGA / "" ;
  define PLACEBO_ / "" ;
  define row_sum/ computed  "" style(column)={cellwidth=1in just = center};
  break after Category / ol skip suppress;
  compute before ;
 line @1 'Race';
endcomp;
  compute row_sum / character length=70;
  row_sum = sum(&count,&count2)||'('||strip(sum(&count1,&count3))||')';
  endcompute;
 run; 
proc report data=program1.sex_4 nofs split='*' headline headskip;
column Category DRUGA PLACEBO_ row_sum ;
define Category / group width=15 '' order;
  define DRUGA / "" ;
  define PLACEBO_ / "" ;
  define row_sum/ computed  "" style(column)={cellwidth=1in just = center};
  break after Category / ol skip suppress;
  compute before ;
 line @1 'SEX';
endcomp;
  compute row_sum / character length=70;
  row_sum = sum(&count,&count2)||'('||strip(sum(&count1,&count3))||')';
  endcompute;
 run; 
 proc report data=program1.Country_4 nofs split='*' headline headskip;
column Category DRUGA PLACEBO_ row_sum ;
define Category / group width=15 '' order;
  define DRUGA / "" ;
  define PLACEBO_ / "" ;
  define row_sum/ computed  "" style(column)={cellwidth=1in just = center};
  break after Category / ol skip suppress;
  compute before ;
 line @1 'Country';
endcomp;
  compute row_sum / character length=70;
  row_sum = sum(&count,&count2)||'('||strip(sum(&count1,&count3))||')';
  endcompute;
 run;
proc report data=program1.Ethnic_4 nofs split='*' headline headskip;
column Category DRUGA PLACEBO_ row_sum ;
define Category / group width=15 '' order;
  define DRUGA / "" ;
  define PLACEBO_ / "" ;
  define row_sum/ computed  "" style(column)={cellwidth=1in just = center};
  break after Category / ol skip suppress;
  compute before ;
 line @1 'Ethnic';
endcomp;
  compute row_sum / character length=70;
  row_sum = sum(&count,&count2)||'('||strip(sum(&count1,&count3))||')';
  endcompute;
 run;
 *rbreak after / dol skip summarize;

proc report data=program1.summarydaat3 nofs split='*' headline headskip; ;
  column AGE DRUGA PLACEBO_ row_sum ;
define AGE / group width=15 '' order;
  define DRUGA / "" format=6.2;
  define PLACEBO_ / "" format=6.2;
  define row_sum/ computed  "" style(column)={cellwidth=1in just = center} format=6.2;
  break after AGE / ol skip suppress;
  compute before ;
 line @1 'PLATELET COUNT';
endcomp;
  compute row_sum;
  row_sum = sum(_C2_,_C3_);
  endcompute;
 run; 
ods pdf close;

What I got look like this:

Skyez_1-1688009151488.png

 

5 REPLIES 5
PaigeMiller
Diamond | Level 26

Since the variables in the COLUMN statement are always the same (e.g. AGE DRUGA PLACEBO_ row_sum) you should be able to combine all data sets into one, and then run one PROC REPORT. Since you also have this code

 

 line @1 'Age';

 

in each PROC REPORT, you'd need a variable in the combined data set indicating if the values are AGE or RACE or SEX or ...

 

There's also the %TABLEN macro which seems like it can create the output desired.

--
Paige Miller
Skyez
Calcite | Level 5

Hi, thanks for your explanation! Unfortunately, if I merge them together, I can't use line statement to set category. It always shows error message that 

The BREAK variable row5 is not one of the GROUP or ORDER variables.
Here is my code:
proc report data=program1.summdata nofs split='*' headline headskip; ;
  title1 "Demographic and baseline summary";
  title2 'All Randomized subjects';
  column AGE  DRUGA PLACEBO_ row_sum ;
  define AGE / group width=6 '' order=data;
  define DRUGA / "DRUG A*&agestr" order=data;
  define PLACEBO_ / "PLACEBO*&htstr" order=data;
  *define row_sum/ computed format=comma10.2 "Total*&wtstr";
  *break after age / ol skip suppress;
   *rbreak after / dol skip summarize;
  compute before ;
 line @1 'Age';
endcomp;
compute after row5;
line @7 'Race';
endcomp;
run;
Thanks for your help!
Cynthia_sas
SAS Super FREQ
Hi:
You don't have a variable named ROW5 in your COLUMN statement. So PROC REPORT is telling you the issue. Do you instead mean to test the value of your ROW_SUM variable or some variable from the data???
Cynthia
Skyez
Calcite | Level 5
Hi, thanks for your help. I already fixed this by using %glue.
PaigeMiller
Diamond | Level 26

that's right. If you merge the data sets together, you should NOT use the LINE command.

--
Paige Miller

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

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
  • 5 replies
  • 786 views
  • 0 likes
  • 3 in conversation