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

Returns the position of a variable in dataset (varnum attribute). More...

Go to the source code of this file.

Detailed Description

Uses varnum function to determine position.

Usage:

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

returns:

1

2

NOTE: Variable renegade does not exist in test

Parameters
[in]libdsTwo part dataset (or view) reference.
[in]varVariable name for which a position should be returned
Author
Allan Bowe
Version
9.2

Definition in file mf_getvarnum.sas.