Chapter Contents

Previous

Next
NOTE

NOTE



Returns an observation ID for the current observation of a SAS data set

Category: SAS File I/O


Syntax
Arguments
Details
Examples
See Also

Syntax

NOTE(data-set-id)

Arguments

data-set-id
specifies the data set identifier that the OPEN function returns.


Details

You can use the observation ID value to return to the current observation by using POINT. Observations can be marked by using NOTE and then returned to later by using POINT. Each observation ID is a unique numeric value.

To free the memory that is associated with an observation ID, use DROPNOTE.


Examples

This example calls CUROBS to display the observation number, calls NOTE to mark the observation, and calls POINT to point to the observation that corresponds to NOTEID.

%let dsid=%sysfunc(open(sasuser.fitness,i));
  /* Go to observation 10 in data set */
%let rc=%sysfunc(fetchobs(&dsid,10));
%if %sysfunc(abs(&rc)) %then
  %put FETCHOBS FAILED;
%else
  %do;
      /* Display observation number     */
      /* in the Log                     */
    %let cur=%sysfunc(curobs(&dsid));
    %put CUROBS=&cur;
      /* Mark observation 10 using NOTE */
    %let noteid=%sysfunc(note(&dsid));
      /* Rewind pointer to beginning    */
      /* of data                        */
      /* set using REWIND               */
    %let rc=%sysfunc(rewind(&dsid));
      /* FETCH first observation into DDV */
    %let rc=%sysfunc(fetch(&dsid));
      /* Display first observation number */
    %let cur=%sysfunc(curobs(&dsid));
    %put CUROBS=&cur;
      /* POINT to observation 10 marked  */
      /* earlier by NOTE                 */
    %let rc=%sysfunc(point(&dsid,&noteid));
      /* FETCH observation into DDV */
    %let rc=%sysfunc(fetch(&dsid));
      /* Display observation number 10   */
      /* marked by NOTE                  */
    %let cur=%sysfunc(curobs(&dsid));
    %put CUROBS=&cur;
  %end;
%if (&dsid > 0) %then
  %let rc=%sysfunc(close(&dsid));
The output produced by this program is:
CUROBS=10
CUROBS=1
CUROBS=10

See Also

Functions:

DROPNOTE
OPEN
POINT
REWIND


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.