Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mcf_getfmttype.sas File Reference

Returns the type of the format. More...

Go to the source code of this file.

Detailed Description

Returns the type, eg DATE / DATETIME / TIME (based on hard-coded lookup) else CHAR / NUM.

This macro may be extended in the future to support custom formats - this would necessitate a call to dosubl() for running a proc format with cntlout.

The function itself takes the following (positional) parameters:

PARAMETER DESCRIPTION
fmtnm Format name to be tested. Can be with or without the w.d extension.

Usage:

%mcf_getfmttype(wrap=YES, insert_cmplib=YES)

data _null_;
  fmt1=mcf_getfmttype('DATE9.');
  fmt2=mcf_getfmttype('DATETIME');
  put (fmt:)(=);
run;
%put fmt3=%sysfunc(mcf_getfmttype(TIME9.));

Returns:

‍fmt1=DATE fmt2=DATETIME fmt3=TIME

Parameters
[out]wrap=(NO) Choose YES to add the proc fcmp wrapper.
[out]lib=(work) The output library in which to create the catalog.
[out]cat=(sasjs) The output catalog in which to create the package.
[out]pkg=(utils) The output package in which to create the function. Uses a 3 part format: libref.catalog.package
[out]insert_cmplib=DEPRECATED - The CMPLIB option is checked and values inserted only if needed.

SAS Macros

Related Programs

Todo
"Custom Format Lookups" To enable site-specific formats, make use of a set of SASJS_FMTLIST_(DATATYPE) global variables.

Definition in file mcf_getfmttype.sas.