datahelperdata crunching
About this Entry
Posted by: datahelper

Original: 11/24/2006 8:17 PM
Views: 49
Comments: 0
eProps: 0

Read Comments
Post a Comment
Back to Your Xanga Site



Friday, November 24, 2006

Example of Vilno, with ages and weights

 inlist b/data1 b/data2 ;
mergeby patid ;
addgridvars str: agegrp 1 ;
sendoff(b/showdat1) patid age weight agegrp ;
if (age<50) agegrp = "A" ;
else agegrp = "B" ;
sendoff(b/showdat2) patid age weight agegrp ;
select pat_wgt = avg(weight) by agegrp patid ;
sendoff(b/showdat3) agegrp patid pat_wgt ;
if (patid==4) pat_wgt=2.2*pat_wgt ;
sendoff(b/showdat4) agegrp patid pat_wgt;
select avg_weight = avg(pat_wgt) by agegrp ;
sendoff(b/resultdata) agegrp avg_weight;
turnoff ;

So that's an example of a data processing function in Vilno,
that "cleans" and modifies the data, merges two data sources ,
and calculates average weight for two age groups.

The intermediate calculations are output to datasets, which can then be
printed. If that is not needed, all but the last SENDOFF statement can be
left out.

One or more patients accidentally had two or more weights(wasn't supposed to
happen) measured . Well, OK, for those patients, create a single row with the average of the
available weight values. That's what the first SELECT statement is for.

As you might guess, patient # 4 had weight measured in kilograms ( and everyone else, in
pounds). So convert patient #4 's weight to pounds.

The last SELECT statement creates a dataset with two rows, one for the age-group 0-49, and one
for the age-group 50-100. The average weight for each agegroup is calculated.
 Posted 11/24/2006 8:17 PM - 49 Views - 0 eProps - 0 comments

Give eProps or Post a Comment

Choose Identity
(?)
 
Give eProps (?)
Post a Comment
Add Link | Preview HTML comment help 
  • Say it with Minis! (?)

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)