TRANSCODE= Option
Specifies an attribute in the ATTRIB statement (which
associates a format, informat, label, and length with one or more
variables) that indicates whether character variables are to be transcoded.
Valid in: |
the ATTRIB statement in a DATA step |
Category: |
Information |
Type: |
Declarative |
See: |
ATTRIB Statement under WindowsUNIXz/OS in the
documentation for your operating environment.
|
Syntax
ATTRIB variable-list(s)
attribute-list(s) ;
Required Arguments
- variable-list
-
names the variables
that you want to associate with the attributes.
Tip:List the variables in any form that SAS allows.
- attribute-list
-
specifies one or more
attributes to assign to
variable-list. Multiple attributes can be specified in the ATTRIB statement. For
a complete list of attributes, see the
ATTRIB Statement in SAS Statements: Reference
.
- TRANSCODE= YES | NO
-
Specifies whether to
transcode character variables. Use TRANSCODE=NO to suppress transcoding.
For more information, see
Overview to Transcoding .
Default:YES
Restriction:The TRANSCODE=NO attribute is not supported by some SAS
Workspace Server clients. Variables with TRANSCODE=NO are not returned
in SAS 9.3. Before SAS 9.3, variables with TRANSCODE=NO are transcoded.
Prior releases of SAS cannot access a SAS 9.3 data set that contains
a variable with a TRANSCODE=NO attribute.
Interactions:You can use the VTRANSCODE and VTRANSCODEX functions
to return whether transcoding is on or off for a character variable.
If the TRANSCODE= attribute is set to NO for any
character variable in a data set, PROC CONTENTS prints a transcode
column that contains the TRANSCODE= value for each variable in the
data set. If all variables in the data set are set to the default
TRANSCODE= value (YES), no transcode column is printed.
Examples
Example 1: Using the TRANSCODE= Option with the SET Statement
When you use the SET statement to
create a data set from several data sets, SAS makes the TRANSCODE=
attribute of the variable in the output data set equal to the TRANSCODE=
value of the variable in the first data set. In this example, the
variable Z's TRANSCODE= attribute in data set A is NO because B is
the first data set and Z's TRANSCODE= attribute in data set B is NO.
data b;
length z $4;
z = 'ice';
attrib z transcode = NO;
data c;
length z $4;
z = 'snow';
attrib z transcode = YES;
data a;
set b;
set c;
/* Check transcode setting for variable Z */
rc1 = vtranscode(z);
put rc1=;
run;
Example 2: Using the TRANSCODE= Option with the MERGE Statement
When you use the MERGE
statement to create a data set from several data sets, SAS makes the
TRANSCODE= attribute of the variable in the output data set equal
to the TRANSCODE= value of the variable in the first data set. In
this example, the variable Z's TRANSCODE= attribute in data set A
is YES because C is the first data set and Z's TRANSCODE= attribute
in data set C is YES.
data b;
length z $4;
z = 'ice';
attrib z transcode = NO;
data c;
length z $4;
z = 'snow';
attrib z transcode = YES;
data a;
merge c b;
/* Check transcode setting for variable Z */
rc1 = vtranscode(z);
put rc1=;
run;
Note: The TRANSCODE= attribute
is set when the variable is first seen on an input data set or in
an ATTRIB TRANSCODE= statement. If a SET or MERGE statement comes
before an ATTRIB TRANSCODE= statement and the TRANSCODE= attribute
contradicts the SET statement, an error message will occur.