DATA Step, Macro, Functions and more

How to simplify the comparison of one variable to multiple variables

Reply
Super Contributor
Posts: 323

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

Esteemed Advisor
Posts: 5,543

Re: How to simplify the code

Posted in reply to knveraraju91

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,890

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

Posted in reply to knveraraju91
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
  • 195 views
  • 1 like
  • 3 in conversation