BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Beto16
Obsidian | Level 7
Hi I have a macro that looks like this

From want as a inner join want as b on a.site =b.site
And (a.maxtime1 GT b.mintime2
And
A.maxtime1 LT b.maxtime2
)
Or (a.maxtime1 EQ B.maxtime2
and
Input (substr (a.site11,3,4),4.) LT Input (substr (b.site11,3,4),4.)

Quit;

What I want to do is add C and D options to it
If you need additional info let me know

TIA
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

I don't understand your question. Please clarify, with as much details as possible.

Code/Log are appreciated, especially if you're getting errors.

View solution in original post

6 REPLIES 6
Reeza
Super User

I don't understand your question. Please clarify, with as much details as possible.

Code/Log are appreciated, especially if you're getting errors.

Beto16
Obsidian | Level 7
The macro looks like this
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)

What I want to do is add this here

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
And (a.maxtime1 GT b.mintime2
And
A.maxtime1 LT b.maxtime2
)
Or (a.maxtime1 EQ B.maxtime2
and
Input (substr (a.site11,3,4),4.) LT Input (substr (b.site11,3,4),4.)

Quit;

I don't know how to add C and D. To make it part to section greater than LT than ... thank you
LinusH
Tourmaline | Level 20
I can't see any macro components in your code. Is that a part of your question.

Is the question that you wish to use where as a join criteria. You could, and I suggest that you use one join syntax in your query. Mixing (between where and on) makes it hard to read and may potentially bring undesired results.
Data never sleeps
Beto16
Obsidian | Level 7
Hi Linus
Your right it's not a macro I notice the mend an thought it was one
Your also right it's not a where statement my question us can we add additional something like this
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)

An refer the C and D in the GT LT


The proc table works when it involves two variables but it applies 2 more it doesn't pick them up...what the proc table does is it take the 2 variables an determine if there mintime and maxtime overlaps between the other mintime and maxtime group site ..thanks again
LinusH
Tourmaline | Level 20
I'm not aware of proc table.
First get a code working without macro.
Then troubleshoot your macro logic by using mprint mlogic symbolgen and %put.
If still can't solve it return with full code and log.
Data never sleeps
Beto16
Obsidian | Level 7
The proc table I was referring is this

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)

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1404 views
  • 0 likes
  • 3 in conversation