libname orion "/courses/d0f434e5ba27fe300/mac1" access=readonly; %let DSN = work.test; %let FIRST = %substr(&DSN., 6,1); %put The value of ckbegin = %verify(&DSN., &FIRST.);
In my homework, I am supposed to create a macro variable named DSN which equals work.test, extract the first letter of the data set name work.test and call it FIRST, and use an autocall macro to verify the value of first against a list of valid values. The output to the log should say ckbegin = 0 but my output says ckbegin = 1. I have attached my code and log.
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 70 71 libname orion "/courses/d0f434e5ba27fe300/mac1" access=readonly; NOTE: Libref ORION was successfully assigned as follows: Engine: V9 Physical Name: /courses/d0f434e5ba27fe300/mac1 72 %let DSN = work.test; 73 %let FIRST = %substr(&DSN., 6,1); 74 %put The value of ckbegin = %verify(&DSN., &FIRST.); The value of ckbegin = 1 75 76 77 78 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 90
Where is the list of valid values?
You asked it to find the first character in work.test that is not in t and it is returning 1 since the first character, w, is not in the one character string t.
What kind of sick teacher assigned you homework using the very obscure macro implementation of the obscure VERIFY() function?
Syntax
Required Arguments
source
specifies a character constant, variable, or expression.
excerpt
specifies a character constant, variable, or expression. If you specify more than one excerpt, separate the excerpts with a comma.
Details
The VERIFY function returns the position of the first character in source that is not present in any excerpt. If VERIFY finds every character in source in at least one excerpt, VERIFY returns a 0.
Where is the list of valid values?
You asked it to find the first character in work.test that is not in t and it is returning 1 since the first character, w, is not in the one character string t.
What kind of sick teacher assigned you homework using the very obscure macro implementation of the obscure VERIFY() function?
Syntax
Required Arguments
source
specifies a character constant, variable, or expression.
excerpt
specifies a character constant, variable, or expression. If you specify more than one excerpt, separate the excerpts with a comma.
Details
The VERIFY function returns the position of the first character in source that is not present in any excerpt. If VERIFY finds every character in source in at least one excerpt, VERIFY returns a 0.
Thank you. I understand now!
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.