O'Reilly logo

SAS 9.4 Macro Language, 5th Edition by

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix 4
Syntax for Selected Functions
Used with the %SYSFUNC
Function
Summary Descriptions and Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
Functions and Arguments for %SYSFUNC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
Summary Descriptions and Syntax
This appendix provides summary descriptions and syntax for selected functions that can
be used with the %SYSFUNC function.
Functions and Arguments for %SYSFUNC
The following table shows the syntax for selected functions that can be used with the
%SYSFUNC function. This is not a complete list of the functions that can be used with
%SYSFUNC. For a list of functions that cannot be used with %SYSFUNC, see Table
17.2 on page 284.
Table A4.1 Functions and Arguments for %SYSFUNC
Function Description and Syntax
ATTRC Returns the value of a character attribute for a SAS data set.
%SYSFUNC(ATTRC(data-set-id,attr-name))
ATTRN Returns the value of a numeric attribute for specified SAS data set.
%SYSFUNC(ATTRN(data-set_id,attr-name))
CEXIST Verifies the existence of a SAS catalog or SAS catalog entry.
%SYSFUNC(CEXIST(entry <, U>))
CLOSE
Closes a SAS data set.%SYSFUNC(CLOSE(data-set-id))
CUROBS Returns the number of the current observation.
%SYSFUNC(CUROBS(data-set-id))
439
Function Description and Syntax
DCLOSE
Closes a directory.%SYSFUNC(DCLOSE(directory-id))
DINFO Returns specified information items for a directory.
%SYSFUNC(DINFO(directory-id,info-items))
DNUM Returns the number of members in a directory.
%SYSFUNC(DNUM(directory-id))
DOPEN
Opens a directory.%SYSFUNC(DOPEN(fileref))
DOPTNAME Returns a specified directory attribute.
%SYSFUNC(DOPTNAME(directory-id,nval))
DOPTNUM Returns the number of information items available for a directory.
%SYSFUNC(DOPTNUM(directory-id))
DREAD Returns the name of a directory member.
%SYSFUNC(DREAD(directory-id,nval))
DROPNOTE Deletes a note marker from a SAS data set or an external file.
%SYSFUNC(DROPNOTE(data-set-id | file-id,note-
id))
DSNAME Returns the data set name associated with a data set identifier.
%SYSFUNC(DSNAME(<data-set-id>))
EXIST Verifies the existence of a SAS library member.
%SYSFUNC(EXIST(member-name<,member-type>))
FAPPEND Appends a record to the end of an external file.
%SYSFUNC(FAPPEND(file-id<,cc>))
FCLOSE Closes an external file, directory, or directory member.
%SYSFUNC(FCLOSE(file-id))
FCOL Returns the current column position in the File Data Buffer (FDB)
%SYSFUNC(FCOL(file-id))
FDELETE
Deletes an external file. %SYSFUNC(FDELETE(fileref))
FETCH Reads the next nondeleted observation from a SAS data set into the Data
Set Data Vector (DDV). %SYSFUNC(FETCH(data-set-
id<,NOSET>))
FETCHOBS Reads a specified observation from a SAS data set into the DDV.
%SYSFUNC(FETCHOBS(data-set-id,obs-
number<,options>))
FEXIST Verifies the existence of an external file associated with a fileref.
%SYSFUNC(FEXIST(fileref))
440 Appendix 4 Syntax for Selected Functions Used with the %SYSFUNC Function
Function Description and Syntax
FGET
Copies data from the FDB. %SYSFUNC(FGET(file-
id,cval<,length>))
FILEEXIST Verifies the existence of an external file by its physical name.
%SYSFUNC(FILEEXIST(file-name))
FILENAME Assigns or deassigns a fileref for an external file, directory, or output
device. %SYSFUNC(FILENAME(fileref,file-
name<,device<,host-options<,dir-ref>>>))
FILEREF Verifies that a fileref has been assigned for the current SAS session.
%SYSFUNC(FILEREF(fileref))
FINFO Returns a specified information item for a file.
%SYSFUNC(FINFO(file-id,info-item))
FNOTE
Identifies the last record that was read. %SYSFUNC(FNOTE(file-
id))
FOPEN
Opens an external file. %SYSFUNC(FOPEN(fileref<,open-
mode<,record-length<,record-format>>>))
FOPTNAME Returns the name of an information item for an external file.
%SYSFUNC(FOPTNAME(file-id,nval))
FOPTNUM Returns the number of information items available for an external file.
%SYSFUNC(FOPTNUM(file-id))
FPOINT Positions the read pointer on the next record to be read.
%SYSFUNC(FPOINT(file-id,note-id))
FPOS Sets the position of the column pointer in the FDB.
%SYSFUNC(FPOS(file-id,nval))
FPUT Moves data to the FDB of an external file starting at the current column
position. %SYSFUNC(FPUT(file-id,cval))
FREAD Reads a record from an external file into the FDB.
%SYSFUNC(FREAD(file-id))
FREWIND Positions the file pointer at the first record.
%SYSFUNC(FREWIND(file-id))
FRLEN Returns the size of the last record read, or the current record size for a
file opened for output. %SYSFUNC(FRLEN(file-id))
FSEP Sets the token delimiters for the FGET function.
%SYSFUNC(FSEP(file-id,cval))
FWRITE
Writes a record to an external file. %SYSFUNC(FWRITE(file-
id<,cc>))
Functions and Arguments for %SYSFUNC 441

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required