Hi....I am trying to delete records when the Withdrawn Date is "less then" the Term Start Date. The code below gives me the right output. Can anyone explain to me why the ">" in this context is referring to "less than". Thanks
data Want; set Have; if 'Withdrawn Date'n > 'Term Start Date'n then delete; run;
Because > is read "greater than" from left to right.
"Less than" would look like
if 'Term Start Date'n < 'Withdrawn Date'n then delete;
A way to remember the "wide" end of the > or the < is the "Larger" value when true.
Hi....when I run the code below, I am getting all the records where the Withdrawn Date is LESS than the Term Start Date. But am I correct that the if statement is processed from left to right?
data Want; set Have; if 'Withdrawn Date'n < 'Term Start Date'n then delete; run;
Hi...I was able to track down where the problem is. The missing entries in the Withdrawn Date variable has decimal rather than blank space. I will double check where it has changed to decimal from a blank space. Thanks.
In your case it doesn't matter which direction you read your IF statement.
"Withdrawn Date < Term Start Date then delete" is equivalent to "Term Start Date > Withdrawn Date then delete"
The result set will be the same.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.