Hi,
I saw a similar code online.
What is the function of "case" in this codes? what are they use for?
data want;
set have;
if a ne . then come=1; else come=0;
if b ne . then go=1;else go=0;
if c ne . then home=1;else home=0;
case=1;
run;
data want2;
set have2;
if a ne . then come=1;else come=0;
if b ne . then go=1;else go=0;
if c ne . then home=1;else home=0;
case=0;
run;
@Reeza Thank you. Are there resources you can share or direct me to for better knowledge?
SAS documentation is here: SAS Help Center: SAS Help Center: Welcome
Check out free SAS training resources here: New SAS User
In this case not really, it's base knowledge.
It's a simple assignment operation (case=1). The fact that the variable is called case may be confusing and bad design because CASE often means something else in programming.
However, the best method to test this is to run it and examine the input and output data in my opinion.
CASE is the name of a variable.
What does the variable mean? Your guess is as good as mine.
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.