datahelperdata crunching
About this Entry
Posted by: datahelper

Original: 11/19/2006 5:38 PM
Views: 129
Comments: 0
eProps: 0

Read Comments
Post a Comment
Back to Your Xanga Site



Sunday, November 19, 2006

Change Baseline, 6 lines in Vilno, 23 lines in SAS

 
CHANGE FROM (MESSY) BASELINE
6 LINES IN VILNO
VS
23 LINES IN SAS

Calculate change from baseline , for visits 1, 2, 3 , etc, where the
baseline values are messy (multiple dates, missing values, even 2 or 3
baseline values on the same date for a few patients)

Discard baseline dates that only have missing values.
Use the value from the most recent baseline date, or the average value
if there is more than one row for the most recent baseline date.

The gridfunc transform here uses the composite where clause which , while not
in version 0.85 will be in a later version. (Perhaps a month of coding work). If
later versions of Vilno allow for implicit variable declaration when parsing the classical
transform, then the addgridvars statement becomes unnecessary(making it 5 lines instead
of 6). (However, you can still use the screen, recode, and addgridvars statements simply as
a matter of style, to keep track of all the variables you expect to be there.) I do not include
"turnoff;" which marks the end of one data processing function and the beginning of a later paragraph of
code, because it's a simple matter to upgrade that out in the next version.

6 lines in Vilno (counting the gridfunc statement as 2 lines)

inlist labdata ;
addgridvars float: change ;
gridfunc baseval=avg(value) by labtest patid
where (visit==-1 and value is not null) and highest date ;
change = value - baseval ;
sendoff(labdata2) labtest patid visit date value change baseval ;


----------------------------------------


23 lines in SAS:

proc sort data=labdata ;
by labtest patid visit date ;

data base1 ;
set labdata ;
where visit=-1 and value!=. ;

data bestdate1 ;
set base1 ;
by labtest patid ;
if last.patid ;
rename date=recentdate ;
keep labtest patid recentdate ;

data base2 ;
merge base1 bestdate1 ;
by labtest patid ;
if date=recentdate ;

proc means data=base2 ;
by labtest patid ;
var value ;
output out=base3 mean=meanbase;

data labdata2 ;
merge labdata base3 ;
by labtest patid ;
change = value - meanbase ;




 Posted 11/19/2006 5:38 PM - 129 Views - 0 eProps - 0 comments

Give eProps or Post a Comment

Choose Identity
(?)
 
Give eProps (?)
Post a Comment
Add Link | Preview HTML comment help 
Profile Pic:
Default  |  Choose »  (?)



Back to datahelper's Xanga Site!
Note: your comment will appear in datahelper's local time zone:
GMT -05:00 (Eastern Standard - US, Canada)