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.
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:
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.
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
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!
that's right. If you merge the data sets together, you should NOT use the LINE command.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.