02-07-2016 08:31 AM
I posted this question before I closed that post because after reading my question it was comfusing ..my apologies Enclose is a table that I've what I need is to make item C and D and statements below (IE GT,LT EQ) Thanks for your help and understanding I'm using SAS9.4
Proc r (x,n);x. As &x.&n. %mend;
A.site,a.date,a.%r (site,1),a.%r (mintime,1),a.%r (maxtime,1),a.%r (durtime,1),
B.site,b.date,b.%r (site,2),b.%r (mintime,2), b.%r (maxtime,2),b.%r (durtime,2
C.site,c.date,c.%r (site,3),c.%r (mintime,3),c.%r (maxtime,3),c.%r (durtime,3),
D.site,d.date,d.%r (site,4),d.%r (mintime,4),d.%r (maxtime,4),d.%r (durtime,4
From want as a inner join want as b on a.site =b.site want as c on a.site=c.site want as d on a.site=D. Site
And (a.maxtime1 GT b.mintime2
A.maxtime1 LT b.maxtime2
Or (a.maxtime1 EQ B.maxtime2
Input (substr (a.site11,3,4),4.) LT Input (substr (b.site11,3,4),4.)
02-07-2016 08:47 AM
Without seeing your macro definitions this doesn't help.
Please post your macro definitions and any errors you're receiving.
Your current code doesn't show any WHERE conditions, so you should just be able to add more conditions to the end. If you're running into issues doing so, you'll have to really explain what you're trying to do.
02-07-2016 09:35 AM
02-08-2016 10:52 AM - edited 02-08-2016 03:04 PM
Please post example input data FOR ALL VARIABLES INVOLVED, desired output and rules if any.
You have an example of comparing one apparent time range with another. But now you want to add in at least two more comparisons without saying what you want to compare. Is the A range compared with C before or after comparing with B? Is A compared with D before or after comparing with B or C? Is B compared to either C, D or Both? Or is A compared to C before B... You have a LARGE number of potential cases to address.
Generally the solution is likely to involve putting entire subqueries in paranthesis to get the order correct and not just "adding AND clause members.
The presence of variables named mintime, mintime2, maxtime, maxtime2 (and do you also have a mintime3, mintime4, maxtime3 and maxtime4 that are to be used in the comparisons for C and D?) tend to make me believe that you have data at least partially in a "wide" format. Which may work better in a long form with mintime, maxtime and a period of measure variable such as 1,2,3,4 ....
02-09-2016 03:57 PM
02-09-2016 04:07 PM