TungPham
TungPham

Reputation: 103

Get the last value in a macro variable

I create a macro variable %let param1 = 201601 201602 201603 201604 201605; I don't know how to get the last value of that variable and assign it to a new variable. How should I do that?

Upvotes: 0

Views: 255

Answers (1)

Quentin
Quentin

Reputation: 6378

%let last = %scan(&param1, -1) ;

When the second argument is negative, it scans from the right instead of left.

Upvotes: 1

Related Questions