Chapter Contents

Previous

Next
NOTE

NOTE



Returns an identifier for the current row of a SAS table

Category: SAS Table


Syntax
Details
Example
See Also

Syntax

note-id=NOTE(table-id);

note-id
contains the identifier that is assigned to the row.

Type: Numeric

table-id
is the identifier that was assigned when the table was opened. If table-id is invalid, the program halts.

Type: Numeric


Details

You can use note-id in the POINT function to return to the current row. (Use NOTE to mark a row, then use POINT to return to the row.) Each note-id is a unique numeric value. There can be up to 1,000 note-ids per open table.

To free the memory that is associated with a row ID, use DROPNOTE.


Example

Use NOTE to return the identifier for the 10th row. Then use POINT to point to the row that corresponds to NOTEID.

INIT:
   tableid=open('sasuser.fitness','i');
return;
MAIN:
   /* Read row 10 */
rc=fetchobs(tableid,10);
if (abs(rc) ne 0) then
    do;
       put "Read operation failed";
       return;
    end;
   /* Display the row number in the LOG window */
cur=curobs(tableid);
put "CUROBS=" cur;
   /* Mark row 10 */
noteid=note(tableid);
   /* Rewind the pointer to the beginning of the table */
rc=rewind(tableid);
   /* Read first row */
rc=fetch(tableid);
   /* Display the row number */
cur=curobs(tableid);
put "CUROBS=" cur;
   /* POINT to row 10 marked earlier by NOTE */
rc=point(tableid,noteid);
   /* Read the row */
rc=fetch(tableid);
   /* Display the row number to confirm it is 10 */
cur=curobs(tableid);
put "CUROBS=" cur;
return;

TERM:
   if (tableid >0) then rc=close(tableid);
return;

The output produced by this program is

CUROBS=10
CUROBS=1
CUROBS=10

See Also

DROPNOTE

POINT

REWIND


Chapter Contents

Previous

Next

Top of Page

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