Quote substring in marco

Accepted Solution Solved
Reply
Contributor
Posts: 26
Accepted Solution

Quote substring in marco

%let x=%substr("ABCD",2,1); 

What is the correct answer? A or B?


Accepted Solutions
Solution
‎02-21-2017 12:53 PM
Super Contributor
Posts: 283

Re: Quote substring in marco

A is correct.

 

In the macro language, the quoting is not necessary, so the opening " is the first character in the string and A is the second.

 

You could use "%let x=%substr(ABCD,2,1);" and get the result you expect.

View solution in original post


All Replies
Solution
‎02-21-2017 12:53 PM
Super Contributor
Posts: 283

Re: Quote substring in marco

A is correct.

 

In the macro language, the quoting is not necessary, so the opening " is the first character in the string and A is the second.

 

You could use "%let x=%substr(ABCD,2,1);" and get the result you expect.

Super Contributor
Posts: 474

Re: Quote substring in marco

Check it yourself:

 

%let x=%substr("ABCD",2,1); 

%put &X;

Daniel Santos @ www.cgd.pt

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 116 views
  • 1 like
  • 3 in conversation