PK Concentration Table Program

PK Concentration Table Demo Including NALQ

***************************************************************************
** Program: t1-adpc.sas
** Author: DataCeutics, Inc.
** Language/Version: SAS/9.4
** CR Toolkit Version: 2.5.3
** Copyright DataCeutics, Inc 2018
** Description: PK concentration table demo including NALQ
** Macro Calls: %formatm %table4 %print1
*****************************************************************************;
options mprint orientation=landscape ls=150 missing=' ' nobyline;
ods escapechar='~';
ods proclabel = "Plasma Concentrations Summary Table";
*create format for timepoint;
%formatm(ds=adam2.adpc, code=pctptn, decode=pctpt, fmtname=tim);
*get concentration data, select records;
data adpc;set adam2.adpc;
	where ittfl='Y' and anl01fl='Y' ;
	keep usubjid trtp trtpn visit visitnum pctptn pctpt param aval avalc;
	if aval<.02 then aval=.01;
	aval = round(aval,.1);
	if aval > 0;
	visit = substr(visit,1,8);
	format pctptn tim.;
	label visit = 'Study Period'
		trtp = 'Treatment\group'
		pctptn = 'Nominal\sampling\time'
	;
run;

*calculate summary stats, retain output dataset for final report;
%table4(in=adpc,
	dose=trtpn,
	dosefmt=trtp,
	pageby=trtp,
	row= visit=10 pctptn=10,
	result=aval,
	change=none,
	reset=visit,
	totalg=n,
	stats= N mean std cv gmean logcv median min max,
	ods_dest=norep);
	
*keep only NALQ records, calculate frequency;
data nalq;set adpc;
	where avalc contains '<' and pctptn is not null;
	keep usubjid trtp trtpn visit visitnum pctptn pctpt param aval;
run;

proc sort;
	by trtp visit pctptn;
run;

proc freq data=nalq noprint;
	by trtp visit ;
	tables pctptn / out=nalq;
run;

*join NALQ to summary stats, calculate overall N by row as number of summarized values plus N of NALQ;
data _all;
	merge _all(in=a) nalq(in=b);
	by trtp visit pctptn;
	if missing(count) then count = 0;
	r0 = strip(put(input(r1, best.) + count, 8.));
	r1= strip(put(input(r1, best.), 8.));
	r2 = substr(r2,2);
	label visit = 'Study\Period'
		trtp = 'Treatment\group'
		pctptn = 'Nominal\sampling\time'
		r0 = "n"
		r1 = "NALQ"
		r2 = "Mean"
		r3 = "Standard\Deviation"
		r4 = "CV%\Mean"
		r5 = "Median"
		r6 = "Minimum"
		r7 = "Maximum"
		r8 = "Geo\Mean"
		r9 = "CV %\Geo Mean"
	;
run;

*generate final report;
%print1(in=_all,
	suffix=01,
	vars=trtp visit pctptn r0 r1 r2 r3 r4 r5 r6 r7 r8 r9,
	order=trtp visit pctptn,
	flow=trtp 12 visit 12 pctptn 12 r0 4 r1 5 r3 9 r4 9 r8 10 r9 10,
	skip=visit,
	props=list missing spacing =2 spanrows,
	ods_dest=pdf8,
	ods_chars=14,
	ods_cunit=in,
	spltch=\,
	driver=titles.txt,
	docline=lastfoot);