Sunday, December 08, 2013

SAS Programming for PK Time-Concentration Curve Using SGPLOT

Comparing with other software/tools for generating the graphs, SAS/Graph may be inferior. Programming to generate graphs using SAS/Graph languages can be time consuming and the quality of the graphs is usually not so great and not in publication quality. It is also not easy to output the graphs in the commonly used format. With SAS/Graph, we usually create the graph files in .cgm and then use a MS Word macro to load the .cgm files into MS Word file.

Now SAS has offered two new ways to generate the graphs: SASODS Graphics and SAS Stat Graphics. I had previously discussed SAS ODS Graphicswith template using Proc Lifetest to generate the Kaplan-Meier curve.

The procedure SGPLOT in SAS ODS Graphics can be used to generate high quality graph. With SGPLOT available, SAS/Graph procedure GPLOT become obsolete. The programs below illustrate the use of SGPLOT to generate the time-concentration curve for PK concentration data.

The graph generated from the programs is directly outputted in a .pdf file.

data pconc;
  input drug $ time concentration;
datalines;
Test  0   0
Test  1  32
Test  3 100
Test  6 140
Test  12 70
Test  24 25
Test  48  5
Test  72  1
Ref   0   0
Ref   1  40
Ref   3 105
Ref   6 135
Ref  12  80
Ref  24  28
Ref  48   7
Ref  72   0
;

options orientation=landscape nodate;
ods graphics / reset width=9in noborder;
    *width option defines the size of the graph. Noborder option remove  
     the border around the figure;

ods pdf file = "c:\temp\MySGPLOT.pdf"
 pdftoc = 0
 startpage = no
 style = printer
 dpi = 250;   

ods pdf nobookmarkgen;

title1 j=c "FIGURE #.#" ;
title2 j=c "MEAN PLASMA CONCENTRATION VS. TIME CURVES" ;
title3 j=c "BY TREATMENT" ;
title4 j=C "POPULATION:  PK" ;

footnote1 j=l "%upcase(PROGRAM: xxx.sas)                                                                                                                 (&sysdate &systime)";
run ;

proc sgplot data=pconc ;
    series x = time y = concentration
         /group=drug lineattrs = (thickness = 1 pattern=solid) markers;
    xaxis label = 'Time Post Study Drug Administration (hours)' 
         grid values = (0 to 80 by 5);
    yaxis label = 'Mean Concentration' grid values = (0 to 160 by 40); 
    keylegend / location=inside position=topright;
run;


ods pdf close;






















References: 


1 comment:

Sas Online Training Hyderabad said...

very use full and informative post