new to IFC/IFN

Accepted Solution Solved
Reply
Valued Guide
Posts: 854
Accepted Solution

new to IFC/IFN

Running the code below I am expecting to see a 'null' for the check2 variable from the third row.  I get a 'wrong'.  Can someone explain why?

Thank You,

data ifc;

infile cards dsd;

input one two three;

cards;

1,2,3

,2,3

1,,3

1,3, 

;

run;

data test;

set ifc;

check1 = ifc(one,.,'one is null');

check2 = ifc(two = 2,'right','wrong','null');

run;


Accepted Solutions
Solution
‎12-10-2014 12:42 PM
Respected Advisor
Posts: 3,124

Re: new to IFC/IFN

I have made some modifications on your data and your code, now you can easily figure out what is going on:

data ifc;

     infile cards dsd;

     input one two three;

     cards;

1,2,3

,0,3

1,,3

1,3, 

;

run;

data test;

     set ifc;

     check1 = ifc(one,.,'one is null');

     check2 = ifc(two,'right','wrong','null');

run;

Update: a boolean evaluation such as 'two=2' will never be missing, it is either 1 or 0, so this is why you are not getting 'null' as an outcome.

View solution in original post


All Replies
Respected Advisor
Posts: 4,606

Re: new to IFC/IFN

Try :

data test2;

desc = "2 = 1"; c = 2 = 1; output;

desc = "2 = ."; c = 2 = .; output;

desc = ". = ."; c = . = .; output;

run;

pric print data=test2; run;

PG

PG
Solution
‎12-10-2014 12:42 PM
Respected Advisor
Posts: 3,124

Re: new to IFC/IFN

I have made some modifications on your data and your code, now you can easily figure out what is going on:

data ifc;

     infile cards dsd;

     input one two three;

     cards;

1,2,3

,0,3

1,,3

1,3, 

;

run;

data test;

     set ifc;

     check1 = ifc(one,.,'one is null');

     check2 = ifc(two,'right','wrong','null');

run;

Update: a boolean evaluation such as 'two=2' will never be missing, it is either 1 or 0, so this is why you are not getting 'null' as an outcome.

Valued Guide
Posts: 854

Re: new to IFC/IFN

Excellent, thank you!

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 247 views
  • 0 likes
  • 3 in conversation