如题,下面是帮助文档里面的文件,以前不怎么看帮助文档,不过最近在里面找了一下,发现很全很强大,就是看起来觉得很不适应,估计是英文水平比较菜。请高手们帮忙看看,总结一下这两个函数的差别,谢谢了。
好的英语水平真的很重要啊!
%UPCASE and %QUPCASE Functions
Convert values to uppercase.
| Type: | Macro function |
| See also: | |
| %UPCASE (character string | text expression) |
| %QUPCASE(character string | text expression) |
The %UPCASE and %QUPCASE functions convert lowercase characters in the argument to uppercase. %UPCASE does not mask special characters or mnemonic operators in its result, even when the argument was previously masked by a macro quoting function.
If the argument contains a special character or mnemonic operator, listed below, use %QUPCASE. %QUPCASE masks the following special characters and mnemonic operators in its result:
& % ' " ( ) + - * / < > = ? ^ ~ ; , # blankAND OR NOT EQ NE LE LT GE GT IN
%UPCASE and %QUPCASE are useful in the comparison of values because the macro facility does not automatically convert lowercase characters to uppercase before comparing values.
- %QUPCASE masks the same characters as the %NRBQUOTE function.
- To convert characters to lowercase, use the %LOWCASE or %QLOWCASE autocall macro.
Example 1: Capitalizing a Value to be Compared In this example, the macro RUNREPT compares a value input for the macro variable MONTH to the string DEC. If the uppercase value of the response is DEC, then PROC FSVIEW runs on the data set REPORTS.ENDYEAR. Otherwise, PROC FSVIEW runs on the data set with the name of the month in the REPORTS data library.
%macro runrept(month); %if %upcase(&month)=DEC %then %str(proc fsview data=reports.endyear; run;); %else %str(proc fsview data=reports.&month; run;);%mend runrept;
You can invoke the macro in any of these ways to satisfy the %IF condition:
%runrept(DEC)%runrept(Dec)%runrept(dec)
Example 2: Comparing %UPCASE and %QUPCASE These statements show the results produced by %UPCASE and %QUPCASE:
%let a=begin;%let b=%nrstr(&a);%put UPCASE produces: %upcase(&b);%put QUPCASE produces: %qupcase(&b);
When these statements execute, the following is written to the SAS log:
UPCASE produces: beginQUPCASE produces: &A