SASデータセットの現在のオブザベーションのオブザベーションIDを返します。
カテゴリ: | SASファイルI/O |
%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, ¬eid)); /* 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));
CUROBS=10 CUROBS=1 CUROBS=10