VARTRANSCODE Function

Returns the transcode attribute of a SAS data set variable.
Category: Variable Information

Syntax

VARTRANSCODE(data-set-id, var-num)

Required Arguments

data-set-id
specifies the data set identifier that the OPEN function returns.
var-num
specifies the position of the variable in the SAS data set.
Tip:The VARNUM function returns this value.

Details

Transcoding is the process of converting data from one encoding to another. The VARTRANSCODE function returns 0 if the var-num variable does not transcode its value, or 1 if the var-num variable transcodes its value.
For more information about transcoding variables, see Transcoding in SAS National Language Support (NLS): Reference Guide. For information about encoding values and transcoding data, see SBCS, DBCS, and Unicode Encoding Values When Transcoding SAS Data in SAS National Language Support (NLS): Reference Guide.

Example

The following example shows how to determine whether a character variable is transcoded:
data a;
   attrib x length=$3. transcode=no;
   attrib y length=$3. transcode=yes;
   x='abc';
   y='xyz';
run;
data _null_;
   dsid=open('work.a','i');
   nobs=attrn(dsid,"nobs");
   nvars=attrn(dsid,"nvars");
   do i=1 to nobs;
      xrc=fetch(dsid,1);
      do j=1 to nvars;
         transcode = vartranscode(dsid,j);
         put transcode=;
      end;
   end;
run;
SAS writes the following output to the log:
transcode=0
transcode=1

See Also

Functions:
ATTRN Function in SAS Functions and CALL Routines: Reference
OPEN Function in SAS Functions and CALL Routines: Reference
VARNUM Function in SAS Functions and CALL Routines: Reference