I'm trying to understand the following code:
data final_eligibilityfile (drop=dtstart);
merge eligibility_2 (in=a) status (in=b) county (in=c) ;
by PID starting ending;
if a;
run;
Two questions:
- What is the purpose of (in=b) and (in=c) if we don't reference b or c later on in the code (?) (as far as I'm aware)
- What does the "if a" mean? Does that mean if a given variable is in a (e.g. "eligibility_2")?
Thank you!
in= variable creates a binary variable that tells you if that input data set contributes to this observation. Correct--if you don't use them, there is no point in making them.
The IF statement is a subsetting IF. If the variable is true (1 in this case) processing is continued and the observation is output.
The code is keeping all observations that come at least in part from the eligibility_2 data set.
in= variable creates a binary variable that tells you if that input data set contributes to this observation. Correct--if you don't use them, there is no point in making them.
The IF statement is a subsetting IF. If the variable is true (1 in this case) processing is continued and the observation is output.
The code is keeping all observations that come at least in part from the eligibility_2 data set.
Creates a Boolean variable that indicates whether the data set contributed data to the current observation.
@cdubs wrote:
I'm trying to understand the following code:
data final_eligibilityfile (drop=dtstart); merge eligibility_2 (in=a) status (in=b) county (in=c) ; by PID starting ending; if a; run;
Two questions:
- What is the purpose of (in=b) and (in=c) if we don't reference b or c later on in the code (?) (as far as I'm aware)
- What does the "if a" mean? Does that mean if a given variable is in a (e.g. "eligibility_2")?
Thank you!
Perhaps you should investigate the free online courses and tutorials at https://support.sas.com/edu/elearning.html?ctry=us&productType=library
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.