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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.