VARINFMT Function


VARINFMT Function

Returns the informat assigned to a SAS data set variable

Category: SAS File I/O

Syntax

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

Arguments

data-set-id

  • specifies the data set identifier that the OPEN function returns.

var-num

  • specifies the number of the variable's position in the SAS data set.

  • Tip: This number is next to the variable in the list that is produced by the CONTENTS procedure.

  • Tip: The VARNUM function returns this number.

Details

If no informat has been assigned to the variable, a blank string is returned.

Examples

Example 1: Using VARINFMT to Obtain the Informat of the Variable NAME

This example obtains the informat of the variable NAME in the SAS data set MYDATA.

 %let dsid=%sysfunc(open(mydata,i));  %if &dsid %then     %do;        %let fmt=%sysfunc(varinfmt(&dsid,                          %sysfunc(varnum                             (&dsid,NAME))));        %let rc=%sysfunc(close(&dsid));     %end; 

Example 2: Using VARINFMT to Obtain the Informat of all the Variables in a Data Set

This example creates a data set that contains the name and informat of the variables in MYDATA.

 data vars;     length name $ 8 informat $ 10 ;     drop dsid i num rc;     dsid=open("mydata","i");     num=attrn(dsid,"nvars");     do i=1 to num;        name=varname(dsid,i);        informat=varinfmt(dsid,i);        output;     end;     rc=close(dsid);  run; 

See Also

Functions:

  • 'OPEN Function' on page 690

  • 'VARFMT Function' on page 871

  • 'VARNUM Function' on page 877




SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 704

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net