@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.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.