RE: SAS program or SAS macro to prepare NonMem ready data
From: From: "Bonate, Peter" pbonate@ilexonc.com
Subject: RE: [NMusers] SAS program or SAS macro to prepare NonMem ready data
Date: Wed, December 8, 2004 11:25 am
The SAS code to generate a NONMEM data set is actually very easy.
Suppose you have a data set (called DATA) sorted by id, time with variables
ID TIME CONC DOSE. Dose can occur on every record or not as long as it has
a value for the first record for each subject. Then you can generate the
data within a data step. Here is a sample code for an oral dose given every
24 hours with observations at steady-state. Each subject has data collected
on one occasion.
proc sort data=data; by id time; run; quit;
data nonmem;
set data;
by id;
if first.id then do;
evid = 1;
mdv = 1;
ii = 24;
ss = 2;
dv = 0;
cmt = 1;
amt = dose;
output;
amt = .;
ii = .;
ss = .;
evid = 0;
dv = conc;
if dv = . then mdv = 1; else mdv = 0;
cmt = 2;
end;
else do;
amt = .;
ii = .;
ss = .;
evid = 0;
dv = conc;
if dv = . then mdv = 1; else mdv = 0;
cmt = 2;
end;
run; quit;
Now suppose you have data on multiple occasions coded by a new variable 'OCC'. The
code would be the same except for the following:
1.) Change proc sort data=data; by id time; run; quit; to proc sort data=data; by id occ time; run; quit;
2.) change if first.id then do; to if first.occ then do;
You may need to tweak it a little bit for specific cases but this should do the trick.
Pete Bonate
Peter L. Bonate, PhD, FCP
Director, Pharmacokinetics
ILEX Oncology
4545 Horizon Hill Blvd
San Antonio, TX 78229
phone: 210-949-8662
fax: 210-949-8219
email: pbonate@ilexonc.com