Hi All,
I ran into a problem in which I need to write a long logic expression: A01=1 OR A02=1 OR A03=1 OR A04=1 OR... A15=1 then TF=1;
Not sure if there is an easy and quick way to write the code? Say, IF any of (A01--A15) =1 then TF=1?
Thanks
If you create an array holding the variables, there are two methods. The array:
array alist {15} a01-a15;
Then you could search with:
if whichn(1, of alist{*}) then TF=1;
Surprisingly, this method also works (once the array is defined):
if 1 in alist then TF=1;
If you create an array holding the variables, there are two methods. The array:
array alist {15} a01-a15;
Then you could search with:
if whichn(1, of alist{*}) then TF=1;
Surprisingly, this method also works (once the array is defined):
if 1 in alist then TF=1;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.