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 (September 2009, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 28 Sep 2009 13:40:29 -0700
Reply-To:     Anaconda <rune@FASTLANE.NO>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Anaconda <rune@FASTLANE.NO>
Organization: http://groups.google.com
Subject:      Macrotrouble - ERROR: Required operator not found in expression
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1

The macro below is supposed to check if a dataset exists or not. And if it exists, then count the number of observations in it. What does the error message in the SAS log mean?

- Anaconda

%macro nobs(dsn); %if exist("&dsn") %then %do; dsid = open("&dsn", "i"); nobs = attrn(dsid, "nlobs"); %end; %else nobs = . ; rc = close(dsid); %mend; %nobs(Sashelp.Class) ;

/* 14353 %macro nobs(dsn); 14354 %if exist("&dsn") %then %do; 14355 dsid = open("&dsn", "i"); 14356 nobs = attrn(dsid, "nlobs"); 14357 %end; 14358 %else nobs = . ; 14359 rc = close(dsid); 14360 %mend; 14361 %nobs(Sashelp.Class) ; ERROR: Required operator not found in expression: exist("&dsn") ERROR: The macro NOBS will stop executing.

*/


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