10-23-2016 09:30 AM
I am trying below code to subset the but not getting result as expected.
INFILE DATALINES DSD DLM=' ';
INPUT A B;
DATA X Y;
IF A=1 AND B IN (1,2,3) THEN OUTPUT X;
IF A=1 AND B IN (4,5,6,7) THEN OUTPUT Y;
Data set X:
Data set Y:
can anyone please let me know where I am doing wrong.
10-23-2016 10:45 AM
Take a look at dataset a, if it really looks as expected.
Next, inspect the log of both steps; if that does not give you a clue, post the log and the list outputs of both datasets.
10-23-2016 01:10 PM
Your expectations are right on the money.
Many times, the board can diagnose the error with no help ... no log, no PROC PRINT results, no PROC CONTENTS results. Unfortunately, this is not one of those times. If you didn't get what you expected, you may have to show what the results actually were.
10-24-2016 10:36 AM
When I run your code as posted I get exactly the desired result posted.
If your unexpected result is coming from a larger different data set A or the logic is more complex then that could be the diffrence. If you expect an output record everytime variable A=1 it may be that variable B has unexpected values such as missing or out of range of the exact values placed in the IN operator arguement.