BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
talzy7
Calcite | Level 5
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   
1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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

VERIFY(source, excerpt-1 <, ...excerpt-n>)

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.
 

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

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

VERIFY(source, excerpt-1 <, ...excerpt-n>)

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.
 
talzy7
Calcite | Level 5

Thank you. I understand now!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

SAS Enterprise Guide vs. SAS Studio

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 792 views
  • 0 likes
  • 2 in conversation