@Hello_there wrote:
Could you explain what is 0 in the "if 0 then set have (keep=color);" part?
The numeric value 0 as an IF condition is interpreted as the Boolean value FALSE. Hence, what follows after THEN (here: the SET statement) is never executed. Yet, the SET statement and also the KEEP= dataset option have an impact during the compilation of the DATA step: Variable COLOR (and no other variable from dataset HAVE) enters the program data vector (PDV) retrieving the variable type (character) and length (8 bytes) from dataset HAVE. Thus it is already available when the INPUT statement is reached. As a consequence, we neither need to specify the type (e.g., the dollar sign in "input color $"), nor the length of COLOR explicitly in this DATA step.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.