BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
FreelanceReinh
Jade | Level 19

@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.

Hello_there
Lapis Lazuli | Level 10
Thanks for the thorough explanation!

I appreciate the time you take to expound on these concepts.

SAS Innovate 2025: Register Now

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!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 16 replies
  • 2171 views
  • 11 likes
  • 6 in conversation