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.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 3700 views
  • 11 likes
  • 6 in conversation