filtering one file based on results from other

Can anybody help me with writing a script for the data that I want to use from one file based on the data from another file. I have file1 in this form;

(the first field represents a well name and the second field represents the depth of interest)
FILE1
--------

DATA_35_0 -4065.517
DATA_48_0 -4043.609
............... .............
............... .............

The second file is of the form;

FILE2
-------

DATA_35_0 392409.2 2966457. 25.00000
DATA_35_0 392408.6 2966463. -2374.779
DATA_35_0 392408.4 2966463. -2474.773
DATA_35_0 392408.2 2966464. -2574.767
DATA_35_0 392408.2 2966464. -2674.762
DATA_35_0 392408.3 2966464. -2774.757
DATA_35_0 392408.5 2966464. -2874.752
DATA_35_0 392410.7 2966464. -3374.687
DATA_35_0 392411.2 2966463. -3474.669
DATA_35_0 392411.6 2966463. -3574.651
DATA_35_0 392412.1 2966462. -3674.633
DATA_35_0 392412.7 2966462. -3774.612
DATA_35_0 392413.2 2966462. -3874.585
DATA_35_0 392413.9 2966461. -3974.552
DATA_35_0 392414.6 2966461. -4074.514
DATA_35_0 392415.3 2966460. -4174.471
DATA_35_0 392416.1 2966460. -4274.429
DATA_35_0 392416.9 2966460. -4374.381
DATA_35_0 392417.8 2966459. -4474.324
DATA_35_0 392418.7 2966458. -4574.263
DATA_35_0 392419.5 2966458. -4674.216
............... ............. ............ ...............

I want to filter the file2 in a way that it only puts out the data where column 4 in the file2 is less than or equal to the second column in file 1. Thus in if file1 only had one record i.e. DATA_35_0 -4065.517, then I want the file2 to be filtered so that it it becomes (based on column 4) as follows;

DATA_35_0 392414.6 2966461. -4074.514
DATA_35_0 392415.3 2966460. -4174.471
DATA_35_0 392416.1 2966460. -4274.429
DATA_35_0 392416.9 2966460. -4374.381
DATA_35_0 392417.8 2966459. -4474.324
DATA_35_0 392418.7 2966458. -4574.263
DATA_35_0 392419.5 2966458. -4674.216

i.e the column 4 (and the coresponding other columns) are output wherever the column 4 is lessthan or equal to -4065.517

I'm not sure if I've understand you right. Does this snipped the work?

while read a ; do K="${a##* }" ; awk -vK=${K} '{if ($NF<=K) print}' FILE2 ; done < FILE1

Yes.... It works perfectly as I wanted it. Thanks a million for your help. I really appreciate it.