The SAS message data
set must be a 7-bit ASCII data set. Any character that cannot be
represented in the 7-bit ASCII encoding is represented in the Unicode
escape format of '\uxxxx', where 'xxxx' is the base 10 numeric representation
of the Unicode value of the character.
The data set used by
the SASMSG function must have been created specifically for use with
this function. The dataset must contain the following variables:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
key to identify the
message
|
|
|
|
|
line # of the message
in reverse order
|
|
|
|
|
|
The data set must be
sorted on the following variables:
locale,
key, and
lineno. The variable
lineno must be in descending order. A composite index on locale and key
must be defined. Here is a sample program to sort and create an indexed
data set:
%let basename=MyProduct;
proc sort data=t.&basename;
by locale key descending lineno;
run;
proc datasets lib=t
memtype=data;
modify &basename;
index create indx=(LOCALE KEY);
run;
quit;
The returned message
is based on the LOCALE system option. The LOCALE option is represented
by
ll_RR where ll represents
the two-letter language code and RR represents the two-letter region
code. If a match is not found, then the function searches for a match
with the language only. If the pair locale and key are still not found,
then the function defaults to the English language (en). If the key
does not exist for English (en), then the key name is returned.
You can alter formatting.
You can use string substitution by using the format code %s. You
can change the order of substitution. In some cases, translation of
a message to a language other than English might require changing
the order of substitutions. You can change the order by placing an
argument number specification,
#nn, within a format string, where
nn is the number of the argument in the substitution list. The following
example demonstrates the order:
|
|
msg = sasmsg
("nls.mymsg","IN_CD_LOG",
"noquote","cat","dog");
IN_CD_LOGINFO = My %#1s. Your %#2s
|
|
IN_CD_LOGINFO = My %#2s. Your %#1s
|
|
The SASMSG function
can be used in the open code macro with the %SYSFUNC macro function.
Arguments that are passed
to a function called by the %SYSFUNC macro must not be in quotes while
arguments passed to the SASMSG function outside of %SYSFUNC must be
quoted.
When the SASMSG function
is used with the %SYSFUNC macro function the returned string is wrapped
with the %NRBQUOTE function.