Concentration Plot Program

Graph4 Report Macro Demo

options mprint orientation=landscape linesize=200;
***************************************************************************
** Program: pkconcplot.sas
** Author: DataCeutics, Inc.
** Language/Version: SAS/9.4
** CR Toolkit Version: 2.5.3
** Copyright DataCeutics, Inc 2018
** Description: Graph4 report macro demo.
** Macro Calls: %formatm %graph4
*****************************************************************************;

options orientation=landscape mprint nodate;

ods proclabel = "Mean Plasma Concentrations Plot";

*macro to reset goptions between graph4 calls;
%macro gopt;
	goptions
	gsfmode= replace
	reset = global
	gunit = cells
	htext = 1.25
	htitle = 1.25
	cback = white
	colors = (black green yellow blue red orange cyan pink brown magenta grey)
	reset = symbol;
	pattern1 v=s color=black; pattern2 v=x1 color=green;
	pattern3 v=s color=yellow; pattern4 v=r3 color=blue;
	pattern5 v=s color=red; pattern6 v=l3 color=orange;
	pattern7 v=s color=cyan; pattern8 v=x3 color=pink;
	pattern9 v=s color=brown;
	symbol1 interpol=join value=dot color=red width=1.5 height=1.5;
	symbol2 interpol=join value=diamond color=black width=1.5 height=1.5;
	symbol3 interpol=join value=circle color=red width=.5 height=1;
	symbol4 interpol=join value=triangle color=black width=.5 height=1;
	symbol5 interpol=join value=star color=black width=.5 height=1;
	symbol6 interpol=join value=square color=black width=.5 height=1;
	symbol7 interpol=join value=hash color=black width=.5 height=1;
	axis5 order=(-0 to 70 by 10) minor=none;
	axis2 order=(-0 to 500 by 50) minor=none;
	axis3 order=(0.01,1,10,100) logbase=10 logstyle=expand;
	axis4 order=(-0 to 130 by 10) minor=none;
run;
%mend gopt;
%include 'V:\cr_toolkit\documents\samples\PK samples 2017\toolkit reports\graph4.sas';

*create format for timepoint;
%formatm(ds=adam2.adpc, code=pctptn, decode=pctptn, fmtname=tim);

*get PC data, select records;
data adpc;set adam2.adpc;
	where ittfl='Y' and anl01fl='Y' and pctptn > 0;
	studyid='ABC123';
	aval = round(aval, .01);
	if aval<.02 then aval=.01;
	label aval='Conc(ug/mL)'
		pctptn='Time (min) since dose'
		trtp = 'Treatment Group';
	format pctptn tim.;
run;

%gopt;

*linear concentration plots of treatment group means;
%graph4(in=adpc,
	pageby=visit,
	dose=trtpn,
	dosefmt=trtp,
	gtype=mean,
	v_var=aval,
	h_var=pctptn,
	id_var=trtp,
	interpol=j,
	offset=2,
	opts=noframe vaxis=axis5 haxis=axis2,
	opts2= noaxis vaxis=axis5,
	suffix=01,
	type=,pagenum=1,
	driver=titles.txt,
	docline=lastfoot,
	ods_dest=pdf9g);
	
*reset goptions;
%gopt;

*generate log plot of concentrations;
%graph4(in=adpc,
	pageby=visit,
	dose=trtpn,
	dosefmt=trtp,
	gtype=mean,
	v_var=aval,
	h_var=pctptn,
	id_var=trtp,
	interpol=j,
	offset=2,
	opts=noframe vaxis=axis3 haxis=axis2,
	opts2= vaxis=axis3 noaxis,
	suffix=02,
	type=,pagenum=1,
	driver=titles.txt,
	docline=lastfoot,
	ods_dest=pdf9g);
	
*subset data to demo spaghetti plot;
data adpc2;
	set adpc;
	if input(scan(usubjid,2,'-'), 4.) < 3100;
run;

goptions
colors = (black)
reset = symbol;
options nobyline;
*plot individual patient concentration over time;
%graph4(in=adpc2,
	pageby=visit trtp,
	dose=trtpn,
	dosefmt=trtp,
	gtype=,
	v_var=aval,
	h_var=pctptn,
	id_var=usubjid,
	interpol=j,
	offset=2,
	opts=frame vaxis=axis4 haxis=axis2 nolegend,
	opts2=noaxis,
	suffix=03,
	type=,pagenum=1,
	driver=titles.txt,
	docline=lastfoot,
	ods_dest=pdf9g);