Production Ready Macros for SAS Application Developers
https://github.com/sasjs/core
mf_getvarlen.sas File Reference

Returns the length of a variable. More...

Go to the source code of this file.

Detailed Description

Uses varlen function to identify the length of a particular variable. Usage:

data test;
   format str $1.  num datetime19.;
   stop;
run;
%put %mf_getVarLen(test,str);
%put %mf_getVarLen(work.test,num);
%put %mf_getVarLen(test,renegade);

returns:

1
8
NOTE: Variable renegade does not exist in test
Parameters
libdsTwo part dataset (or view) reference.
varVariable name for which a length should be returned
Returns
outputs length
Author
Allan Bowe
Version
9.2

Definition in file mf_getvarlen.sas.