03-28-2013 02:26 PM
I received a request from a customer to develop a report using multiple tables with multiple scenarios. My thought was to combine all of the "and" and then the "or" groups. The report should show data if the following conditions are present Here is the example:
((if elapse_days <=15 and if Ins_Code in ('A','B') or if Ins_Code EQ spaces) AND IF Assoc_ID not like Z AND ((IF Prop_Type NE 2 OR If Prop_Type EQ 2 and Disburement NE 250))
Here is what I am doing so far;
%let elapse = TODAY()-Set_Date;
data INS1(keep=ID Ins_Code Elapse_Time);
where Ins_Code in ('A','B','');
This is where I stopped. I need to address the following:
Assoc_ID(from a table called File2),
Prop_Type(from File3) and
The part I have bolded is where I get stuck. At some point in time I need to merge the 4 tables based on the ID
03-28-2013 02:34 PM
just to get you started. I'm not sure if you need inner or outer joins based on your requirements.
create table want as
inner join file2 t2
inner join file3 t3
inner join file4 t4
(date() - t1.set_date) <=15
and t2.assoc_id not like 'Z%'
and t3.prop_type ne 2
and (t3.prop_type=2 and t4.disbursement ne 250)
03-29-2013 02:00 AM
Could you please tell us some more information about your task?
DO you need a hint about how to join 4 tables (which provided by DBeily), or you need a way to do it based on a certain conditions?
By the way
((IF Prop_Type NE 2 OR If Prop_Type EQ 2 and Disburement NE 250)) == ((IF Prop_Type NE 2 OR Disburement NE 250))
since (not x) or x and y == (not x) or y