DATA Step, Macro, Functions and more

How to simplify the comparison of one variable to multiple variables

Reply
Super Contributor
Posts: 270

How to simplify the comparison of one variable to multiple variables

[ Edited ]

Dear,

 

I have to write a IF condition. 

 

Eg: If date gt date1 and date gt date2 and so on for several variables. Is ther way to simplify the code.

 

My code:IF date gt in(date1-date16)Please help. Thanks

Respected Advisor
Posts: 4,640

Re: How to simplify the code

Suppose you have 9 dates: date1 to date9:

 

 

if date gt max(date1, date2, date3,..., date9)

 

or

 

if date gt max(of date1-date9)

PG
Super User
Posts: 5,254

Re: How to simplify the comparison of one variable to multiple variables

Your inquiry indicates that you need to transpose your data set from wide to long.
Data never sleeps
Ask a Question
Discussion stats
  • 2 replies
  • 168 views
  • 1 like
  • 3 in conversation