Hi, everyone. Brand new to the forum. I'm writing a SAS code at work to check fields in a dataset, that uses an if statement with a long list of values. I'll write a version of my code before I go any further.
(in a data step)
if comp1 not in ('ABC' 'BMW' 'CDC' 'DOW' 'FDIC' 'HSHS' 'IKEA' 'JVC' 'KDA' ..... 'XYZ')
then comp1 = comp2;
proc freq data=comps ;
tables comp2*comp1 / list missing;
run;
Let's say that comp1 and comp2 are similar variables that take on the same values, but comp2 is just a bit more cleaned up. Is there a way to check this code in case I happen to leave out a value in the list, or someone else deletes one accidentally? Right now if 'BMW' was somehow deleted, the code would still run, but you'd possibly not even know something was wrong. Would you create a new variable in the if statement, and then perform a 3-way proc freq?
Thanks.
(in a data step)
if comp1 not in ('ABC' 'BMW' 'CDC' 'DOW' 'FDIC' 'HSHS' 'IKEA' 'JVC' 'KDA' ..... 'XYZ')
then comp1 = comp2;
proc freq data=comps ;
tables comp2*comp1 / list missing;
run;
Let's say that comp1 and comp2 are similar variables that take on the same values, but comp2 is just a bit more cleaned up. Is there a way to check this code in case I happen to leave out a value in the list, or someone else deletes one accidentally? Right now if 'BMW' was somehow deleted, the code would still run, but you'd possibly not even know something was wrong. Would you create a new variable in the if statement, and then perform a 3-way proc freq?
Thanks.