BookmarkSubscribeRSS Feed
wikich
Calcite | Level 5

I want to create a table head for a table, replacing the orignal table head.

The table head contains two rows:

head1 = !!!SS!FAS!PPS!

head2 = !Index!!(N=30)!(N=30)!(N=30)!

Here the ! meaning column delimiter. The head1 is the first row of table head .In head1, the first and second column are blank and the content of third, fourth and fifith are SS, FAS and PPS. 

The head2 is the second row of table head, the content of the first column is index; the second is blank; the third to fifth are (N-30).

I want to form the following table head:


table_head.png

 

 

 

 

 

8 REPLIES 8
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Your question is a bit vague I am afraid.  Creation of Table output for clinical reports is pretty simple, just apply some bits in the proc report:

proc sql noprint;
  select count distinct usubjid) from adsl where ss="Y" into :ss;
  select count distinct usubjid) from adsl where fas="Y" into :fas;
  select count distinct usubjid) from adsl where pps="Y" into :pps;
quit;

ods rtf...;

proc report data=yourdata split="*";
  columns _all_;
  define ss_count / "SS*(%trim(&ss.))";
  define fas_count / "FAS*(%trim(&fas.))";
  define pps_count / "PPS*(%trim(&pps.))";
run;

ods rtf close;
wikich
Calcite | Level 5

Thanks for your answer. I want to write a macro mreport to deal with the table head. The table data has been calculated before.

I want to use the  header parameters (in above case the parameters are head1 and head2) only, to form the table head, without other information of the table. This will make the macro more general. If there is rtf grammer to recognize such form(!!!SS!FAS!PPS!)directly? 

If exists, it will make the macro more easier.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Yes, I have seen this type of thing before.  What I can tell you is that using such a macro is a real pain in the neck and they do not work half the time or do what you want.  It is far simpler to either create a report for each output, or have a template file that then gets updated per the output requirements.  Remember, SAS is very flexible, wrapping it in macro code reduces the flexibility (and simplicity in understanding the code).  Up to you of course, just I have seen it a lot. 

Tom
Super User Tom
Super User

It is hard to create the header to a table in a report without also creating the actual table.

Can you show a simple example of how you intend to use this in a program?

Reeza
Super User

There’s an old paper by Cynthia Zender that walks through how to create clinical tables. It’s titled Creating Complex Reports amd has the ful code and data attached for practice. 

Cynthia_sas
SAS Super FREQ
Thanks, Reeza for the shout out about that paper. It was a popular one. But, yes, hard to believe it is 10 years old! However, that paper does not show using RTF control strings or RTF "grammar" to format something like (!!!SS!FAS!PPS!) that the OP wants to use.

Cynthia
wikich
Calcite | Level 5

Thank you Reeza. I have found the article and begin to read her code.

Reeza
Super User

Just a last note, rather than tags, you can use templates to control layout and styles.

The RTF style here, originally written by a colleague, was what we used to create our clinical reports for journal submissions. There's a little example at the bottom of the code that illustrates the output.

 

https://gist.github.com/statgeek/9603140

 

This is a bit more complex but may help. It uses the Report Writing Interface and is fairly well documented:

https://www.pharmasug.org/proceedings/2013/CC/PharmaSUG-2013-CC13.pdf

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 8 replies
  • 1515 views
  • 2 likes
  • 5 in conversation