BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Wken1122
Obsidian | Level 7

Hi,
Can someone please explain this line of code for me?


IFN(SUM(IFHLDCURR_MRTA,IFHLDCURR_TRDL,IFHLDCURR_INVT)>0,1,0);

Does it mean that the sum of the 3, IFHLDCURR_MRTA,IFHLDCURR_TRDL,IFHLDCURR_INVT are > than 0,1,0 then it will return '1'.
Or does it mean that if sum of IFHLDCURR_MRTA>0 and sum of IFHLDCURR_TRDL>1 and sum of IFHLDCURR_INVT>0, only then it will return '1'.
or any other explanation that i misunderstood?

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

RTM. 

 

IFN(logical-expression, value-returned-when-true, value-returned-when-false
<, value-returned-when-missing>)

 

Logical Expression -> SUM(IFHLDCURR_MRTA,IFHLDCURR_TRDL,IFHLDCURR_INVT)>0

Value when True: 1

Value when False: 0

Value when Missing: Not declared

 

http://documentation.sas.com/?docsetId=lefunctionsref&docsetTarget=n0l3n5z2h31h7wn1fmnqd33ibhap.htm&...

 


@Wken1122 wrote:

Hi,
Can someone please explain this line of code for me?


IFN(SUM(IFHLDCURR_MRTA,IFHLDCURR_TRDL,IFHLDCURR_INVT)>0,1,0);

Does it mean that the sum of the 3, IFHLDCURR_MRTA,IFHLDCURR_TRDL,IFHLDCURR_INVT are > than 0,1,0 then it will return '1'.
Or does it mean that if sum of IFHLDCURR_MRTA>0 and sum of IFHLDCURR_TRDL>1 and sum of IFHLDCURR_INVT>0, only then it will return '1'.
or any other explanation that i misunderstood?

Thank you.


 

View solution in original post

2 REPLIES 2
Reeza
Super User

RTM. 

 

IFN(logical-expression, value-returned-when-true, value-returned-when-false
<, value-returned-when-missing>)

 

Logical Expression -> SUM(IFHLDCURR_MRTA,IFHLDCURR_TRDL,IFHLDCURR_INVT)>0

Value when True: 1

Value when False: 0

Value when Missing: Not declared

 

http://documentation.sas.com/?docsetId=lefunctionsref&docsetTarget=n0l3n5z2h31h7wn1fmnqd33ibhap.htm&...

 


@Wken1122 wrote:

Hi,
Can someone please explain this line of code for me?


IFN(SUM(IFHLDCURR_MRTA,IFHLDCURR_TRDL,IFHLDCURR_INVT)>0,1,0);

Does it mean that the sum of the 3, IFHLDCURR_MRTA,IFHLDCURR_TRDL,IFHLDCURR_INVT are > than 0,1,0 then it will return '1'.
Or does it mean that if sum of IFHLDCURR_MRTA>0 and sum of IFHLDCURR_TRDL>1 and sum of IFHLDCURR_INVT>0, only then it will return '1'.
or any other explanation that i misunderstood?

Thank you.


 

Wken1122
Obsidian | Level 7

Thanks a lot for the clarification!

Catch up on SAS Innovate 2026

Dive into keynotes, announcements and breakthroughs on demand.

Explore Now →
Develop Code with SAS Studio

Get started using SAS Studio to write, run and debug your SAS programs.

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
  • 2 replies
  • 2236 views
  • 4 likes
  • 2 in conversation