BookmarkSubscribeRSS Feed
wcw2
Obsidian | Level 7

Hi,

I'm trying to reproduce summary frequency conmed tables for a CSR, see attached example from an old CSR. Don't need a p-value and coded study drugs input ready to go. Can someone point me to some code or resources for this? I had a tablemacro that used to work but cant find it now. Thanks so much.

7 REPLIES 7
sbxkoenk
SAS Super FREQ

Hello,

 

I would visit

https://www.lexjansen.com/

 

Then search on CONMED or Clinical Study Report (CSR) or FDA.

 

Maybe the table macro you "lost" is here:

Paper AD04
EZTABLE Macros
Author, Daniel Huang, FRX Inc, NJ

https://www.lexjansen.com/pharmasug/2008/ad/AD04.pdf

 

Good luck,

Koen

wcw2
Obsidian | Level 7

Thanks so much Koen. Yes, I have the EZTABLE paper and yes, it shows the output that I want. Problem is, the code for the macros is not there, just a description of each & what each does. I reached out to the author the other day but keep getting an undeliverable. So, I'm stuck for now.

 

 

sbxkoenk
SAS Super FREQ

Hello @wcw2 ,

 

OK, I see.

And Daniel Huang is quite a common name I think, so no luck on internet probably to get hold of him.

 

I will reach out to a "SAS Health and Life Sciences colleague" of mine, but it is already weekend over here in Western Europe, so I do not expect an answer before next Monday or Tuesday.

 

If it's urgent you can re-post under the Solutions header:

Solutions > SAS Health > SAS Health and Life Sciences ! 
That's where your target audience is watching.

 

Stay tuned,

Koen

wcw2
Obsidian | Level 7

Thanks so much Koen, will do. 

William Whitworth, CDC

 

tarheel13
Rhodochrosite | Level 12

**** PERFORM A SIMPLE COUNT OF EACH TREATMENT ARM AND OUTPUT RESULT;

**** AS MACRO VARIABLES.  N1 = 1ST COLUMN N FOR ACTIVE THERAPY,

**** N2 = 2ND COLUMN N FOR PLACEBO, N3 IS THE 3RD COLUMN TOTAL N.;

proc sql noprint;

 

       **** PLACE THE NUMBER OF ACTIVE SUBJECTS IN &N1.;

       select count(distinct usubjid) format = 3.

               into :n1

               from adsl

               where trtpn = 1;

       **** PLACE THE NUMBER OF PLACEBO SUBJECTS IN &N2.;

       select count(distinct usubjid) format = 3.

               into :n2

               from adsl

               where trtpn = 0;

       **** PLACE THE TOTAL NUMBER OF SUBJECTS IN &N3.;

       select count(distinct usubjid) format = 3.

               into :n3

               from adsl

               where trtpn ne .;

quit;

 

***** MERGE CCONCOMITANT MEDICATIONS AND TREATMENT DATA.

***** KEEP RECORDS FOR SUBJECTS WHO HAD CONMEDS AND STUDY THERAPY.

***** GET UNIQUE CONCOMITANT MEDICATIONS WITHIN PATIENTS.;

procsql

       noprint;

       create table cmtosum as

               select unique(c.cmdecod) as cmdecod, c.usubjid, t.trtpn

         from cm as c, adsl as t

         where c.usubjid = t.usubjid

         order by usubjid, cmdecod;

quit;

 

**** GET MEDICATION COUNTS BY TREATMENT AND PLACE IN DATASET COUNTS.;

**** TURN OFF LST OUTPUT.;                                          ➋

ods listing close;

**** SEND SUMS BY TREATMENT TO COUNTS DATA SET.;

ods output CrossTabFreqs = counts;

procfreq

       data = cmtosum;

               tables trtpn * cmdecod;

run;

ods output close;

ods listing;

 

proc sort

       data = counts;

               by cmdecod;

run;

 

**** MERGE COUNTS DATA SET WITH ITSELF TO PUT THE THREE

**** TREATMENT COLUMNS SIDE BY SIDE FOR EACH CONMED.  CREATE GROUP

**** VARIABLE WHICH ARE USED TO CREATE BREAK LINE IN THE REPORT.

**** DEFINE COL1-COL3 WHICH ARE THE COUNT/% FORMATTED COLUMNS.;  ➌

data cm;

       merge counts(where = (trtpn = 1) rename = (frequency = count1))

         counts(where = (trtpn = 0) rename = (frequency = count2))

         counts(where = (trtpn = .) rename = (frequency = count3))

         end = eof;

               by cmdecod;

         keep cmdecodrowlabel col1-col3 section;

         length rowlabel $ 25 col1-col3 $ 10;

 

         **** LABEL “ANY MEDICATION” ROW AND PUT IN FIRST GROUP.

         **** BY MEDICATION COUNTS GO IN THE SECOND GROUP.;

         if cmdecod = '' then

           do;

              rowlabel = “ANY MEDICATION”;

                  section = 1;

           end;

           else

           do;

           rowlabel = cmdecod;

                section = 2;

         end;

 

        **** CALCULATE PERCENTAGES AND CREATE N/% TEXT IN COL1-COL3.;

        pct1 = (count1 / &n1) * 100;

        pct2 = (count2 / &n2) * 100;

        pct3 = (count3 / &n3) * 100;

 

        col1 = put(count1,3.) || “ (” || put(pct1, 3.) || “%)”;

        col2 = put(count2,3.) || “ (” || put(pct2, 3.) || “%)”;

        col3 = put(count3,3.) || “ (” || put(pct3, 3.) || “%)”;

run;

 

**** USE PROC REPORT TO WRITE THE CONMED TABLE TO FILE.;

options nodatenonumber missing = ' ';

odsescapechar='#';

ods pdf style=htmlblue file='program5.5.pdf';

 

proc report

       data=cm

       nowindows

       split = “|”;

 

       columns section rowlabel col1 col2 col3;

 

       define section    /order order = internal noprint;

       define rowlabel /order width=25 “Preferred Medication Term”;

       define col1         /display center width=14 “Active|N=&n1”;

       define col2         /display center width=14 “Placebo|N=&n2”;

       define col3         /display center width=14 “Total|N=&n3”;

 

       compute after section;

               line '#{newline}';

       endcomp;

 

       title1 j=l 'Company/Trial Name'

          j=r 'Page #{thispage} of #{lastpage}';

       title2 j=c 'Table 5.5';

       title3 j=c 'Summary of Concomitant Medication';

run;

ods pdf close;

wcw2
Obsidian | Level 7

Wow, thank you so much! This is very helpful and I'm anxious to give it a spin. Bravo. Will let you know how it goes.

tarheel13
Rhodochrosite | Level 12

Got it from SAS Programming in the Pharmaceutical Industry book. Also, this code does not have drug class in it. It would just get n % for cmdecod and active, placebo, and total columns so it doesn't match exactly what you're trying to do.

 

However, I have made a lot of TLFs for clinical trials if you or @sbxkoenk knows anyone in need of another SAS Programmer. Also, check out my poster at SESUG this fall.

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

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
  • 7 replies
  • 5332 views
  • 4 likes
  • 3 in conversation