Syntax, %UPCASE function:
%UPCASE(character-string|text-expression)
|
%let paidval=n; title "Uncollected Fees for Each Course"; proc means data=certadv.all sum maxdec=0; where paid="&paidval"; var fee; class course_title; run;
163 %let paidval=n; 164 title "Uncollected Fees for Each Course" 165 proc means data=certadv.all sum maxdec=0; 166 where paid="&paidval"; 167 var fee; 168 class course_title; 169 run; NOTE: No observations were selected from data set CERT.ALL.
%let paidval=n;
title "Uncollected Fees for Each Course";
proc means data=certadv.all sum maxdec=0;
where paid="%upcase(&paidval)";
var fee;
class course_title;
run;
Syntax, %SUBSTR function:
%SUBSTR(argument, position, <,length>)
argument
is a character string
or a text expression. If argument might
contain a special character or mnemonic operator, use %QSUBSTR.
position
is an integer or an
expression (text, logical, or arithmetic) that yields an integer,
That integer specifies the position of the first character in the
substring. If position is greater
than the number of characters in the string, %SUBSTR issues a warning
message and returns a null value. An automatic call to %EVAL causes n to
be treated as a numeric value.
length
is an optional integer
or an expression (text, logical, or arithmetic) that yields an integer.
That integer specifies the number of characters in the substring.
If length is greater than the
number of characters following position in
an argument, %SUBSTR issues a warning message and returns a substring
containing the characters from position to
the end of the string. By default, %SUBSTR produces a string containing
the characters from position to
the end of the character string.
|
proc print data=certadv.schedule;
where begin_date between
"30%substr(&sysdate9,3)"d and
"&sysdate9"d;
title "All Courses Held So Far This Month";
title2 "(as of &sysdate9)";
run;
05JAN2017
.
%substr(&date,3)
returns
the value JAN2017
.%substr(&date,3,3)
returns the value JAN
.%substr(&date,3,9)
returns
the value JAN2017
and produces a warning
message.%substr(&var,%length(&var)-1)
returns
the last two characters of the value of the macro variable Var.
Syntax, %INDEX function:
%INDEX (source,
string)
source and string
both are character
strings or text expressions that can include any of the following
elements:
|
0
when
there is no pattern match%let a=a very long value; %let b=%index(&a,v); %put The character v appears at position &b;
The character v appears at position 3
blank
. < ( + & ! $ * ) ; / , % | ^
blank
. < ( + & ! $ * ) ; / , % | ¬ ¦ ¢
Syntax, %SCAN function:
%SCAN (argument,
n<,charlist<,modifiers>>)
argument
consists of constant
text, macro variable references, macro functions, or macro calls.
n
is an integer or a
text expression that yields an integer. That integer specifies the
position of the word to return. If n is
greater than the number of words in argument,
the functions return a null string.
charlist
specifies an optional
character expression that initializes a list of characters. This list
determines which characters are used as the delimiters that separate
words. The following rules apply:
Tip You can add more characters
to charlist by using other
modifiers.modifier
specifies a character
constant, a variable, or an expression in which each non-blank character
modifies the action of the %SCAN function. Blanks are ignored.
|
%let a=one:two-three four; %put First word is %scan(&a,1); %put Second word is %scan(&a,2,:-); %put Last word is %scan(&a,-1);
First word is one:two Second word is two Last word is four
18.225.55.198