Once I asked myself this, I just can't get the question out of my head. The OF symbol (syntax) is not motivated by the English preposition "of", is it?
SAS Help Center: The OF Operator with Functions and Variable Lists
Are you trying to get into the minds of the SAS development team?
Makes sense to me. MAX(of var1-var10) means "take the max of var1 thru var10".
@Tom wrote:
MAX(of var1-var10) means "take the max of var1 thru var10".
yeah, but then there is
CALL MISSING(of var1-var10);
@PhilC wrote:
CALL MISSING(of var1-var10);
This is sort of like saying:
Dear SAS, of this list of variables, var1 through var10, please set them to missing.
I would agree that
MAX(of Var1 - Var10);
is easier to "translate" into English, but I think the paradigm still holds even for MISSING.
The general rule for "translating" into English would be:
of these variables (a list of vars), do this (perform the specified function)
In the case of MISSING:
Of these variables, Var1 - Var10, set them to missing.
In short: "of these, do this".
I think this is a reasonable way of understanding the syntax.
Jim
Ok I get it, thanks for your submissions. Sadly I'm too unsatisfied to press "Accept as Solution", so I'm passing out likes.
@PhilC wrote:
Ok I get it, thanks for your submissions. Sadly I'm too unsatisfied to press "Accept as Solution", so I'm passing out likes.
That because your original goal is a fool's errand .
Software designers create syntax that re-use normal words. But the meaning of the syntax is what the computer language supports, not the normal conversational meaning of that word.
It's a good point to bring up about the re-using of pre-existing reserved words. That dawned on me when a day after the post.
---
"Who's the more foolish, the fool or the fool who follows him?" - George Lucas
The Cambridge Dictionary lists one of the uses of "of" as "relating to". In this sense, the developers used the word well. They used "of" to relate a function to a grouping of variables.
However, to @Tom's point, if we discuss this long enough, the Dictionary of Internet Slang's definition of "of" may soon apply to all of us. 😉
What does "of" mean in slang?The Meaning of OF:
OF means "Old Fart"
@Tom wrote:
Are you trying to get into the minds of the SAS development team?
ha ha, yes I am.
Are you referring to using OF in many functions such as
y=mean(of x1-x5);
???
If so, then this indicates that the function (in this case the MEAN function) is to use a variable list x1-x5.
Or are you asking about other uses? If so, please specify where in SAS you would use this OF
At one time, there was no OF operator. In those bad-old-days, the statement
mean = mean(x1-x100);
computed the mean of x1 minus x100, which was not what anyone would ever likely want.
So SAS added OF to take the mean (or whatever function) *of* a list, suppressing the normal subtraction. More generally, OF can be used with any list. So, yes, the english word "of" makes sense: function of a list of variables.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.