data apple; set lemon (in=1); if a then country='MAC"; where samp ~=' ' and account ~= ' ' and index(applepie,'apple'); length score $20.; score_type=40; run;
hi can you explain the statement 'where samp....'
we are not too sure how the index statement is working here either.. thanks
~= means Not Equal To .
Yes, it will be evaluated for True or False. In SAS, anything else than 0 is considered True.
Where statement doesn't affect logic in your data step, it will filter data to be executed by the data step as a whole.
To control logic use the IF statement.
Yes, it will be evaluated for True or False. In SAS, anything else than 0 is considered True.
Where statement doesn't affect logic in your data step, it will filter data to be executed by the data step as a whole.
To control logic use the IF statement.
if where conditions not met, the line below where statement wont run?
Exactly and it doesn't matter where you have the where statement in the data step. So you should put the where statement directly after the set statement to avoid confusion.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.