LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 2010, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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


Back to: Top of message | Previous page | Main SAS-L page