What does it mean when an if statement is only followed by the name of a library?
As a new user, it's understandable that you wouldn't understand:
IF FIRST.SHORT_ACCOUNT_NUMBER;
It's actually more complicated than it looks, so I can give you the overview only.
IF deletes observations, and continues to process other observations. The ones that satisfy the IF condition continue to be processed, and the others get deleted.
FIRST.SHORT_ACCOUNT_NUMBER is created in a DATA step using a BY statement. What it does, and how it works, will take some study on your part. (You have already been pointed to some reference material.)
The net result in this program handles cases where there are multiple observations for the same SHORT_ACCOUNT_NUMBER:
Hope this at least points you in the right direction.
You mean "name of a variable"?
If that's the case, you are referring to a "subsetting if". It means that any observation that does meet the criteria, is not processed further on in the data step. So any explicit or implicit output will not be performed.
If you just name a variable, for a numerical value of 0 means false (subset will occur), any other value is evaluated as true (processing will proceed with the following steps).
Do you have an example?
Try to execute it, evaluate the results. Potentially change input data/IF statement and see the differences.
for example:
DATA CR_OPEN_IO_PART_TEMP_1; SET CR_OPEN_IO_PART_TEMP; BY SHORT_ACCOUNT_NUMBER; IF FIRST.SHORT_ACCOUNT_NUMBER; RUN; |
The by statement:
BY SHORT_ACCOUNT_NUMBER;
Creates a binary value, 1 for true, 0 for false, which is set based on whether a value is the first occurrence of a value in that variable. A bit like:
SHORT_ACCOUNT_NUMBER ISFIRST
A 1
A 0
...
The if:
IF FIRST.SHORT_ACCOUNT_NUMBER;
Is the same as saying: if isfirst=1 then output;
Please dont code all in uppercase, it makes code painful to read.
As a new user, it's understandable that you wouldn't understand:
IF FIRST.SHORT_ACCOUNT_NUMBER;
It's actually more complicated than it looks, so I can give you the overview only.
IF deletes observations, and continues to process other observations. The ones that satisfy the IF condition continue to be processed, and the others get deleted.
FIRST.SHORT_ACCOUNT_NUMBER is created in a DATA step using a BY statement. What it does, and how it works, will take some study on your part. (You have already been pointed to some reference material.)
The net result in this program handles cases where there are multiple observations for the same SHORT_ACCOUNT_NUMBER:
Hope this at least points you in the right direction.
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.