Date: Tue, 3 Nov 2009 08:49:04 +0800
Reply-To: jiyuan123 <jiyuan123@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: jiyuan123 <jiyuan123@GMAIL.COM>
Subject: A question about attrn function(NOBS, NLOBS,NLOBSF)
Content-Type: text/plain; charset="us-ascii"
Hi SAS-Lers,
I want write a macro to return numbers of datasets observation.
and I also want it can execute WHERE CLAUSE situation.
I read a ariticle "How Many Observations Are In My Data Set?"
Authors:Jack Hamilton, First Health, West Sacramento, California.
I find a question. If you use %sysfunc(open(test, I)); It's OK.
But If you use %sysfunc(open(test, IS)); , the result of NLOBSF is -1.
thanks a lot.
data test;
a=1;
b='c';
run;
%macro check;
%let dsid =
%sysfunc(open(test, IS));
%if &DSID = 0 %then
%put %sysfunc(sysmsg());
%let nobs=%sysfunc(attrn(&dsid,NOBS));
%put nobs=&nobs.;
%let nlobs = %sysfunc(attrn(&dsid,NLOBS));
%put nlobs=&nlobs.;
%let nlobsf = %sysfunc(attrn(&dsid,NLOBSF));
%put nlobsf=&nlobsf.;
%let rc = %sysfunc(close(&dsid));
%mend;
%check;
2009-11-02
--------------------------------------------------------------------------------
yuan.ji
|