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 (January 2007, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 10 Jan 2007 14:23:47 -0500
Reply-To:     "data _null_;" <datanull@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "data _null_;" <datanull@GMAIL.COM>
Subject:      Re: How to check if dataset has any obs or not
Comments: To: Rune Runnestø <rune@fastlane.no>
In-Reply-To:  <IMWdnQHU8caGpjjYRVnzvA@telenor.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

It is a function style macro try.

%let nobs = %getnumofobs(data=sashelp.class); or %put %getnumofobs(data=sashelp.class);

On 1/10/07, Rune Runnestø <rune@fastlane.no> wrote: > "toby dunn" <tobydunn@HOTMAIL.COM> wrote in message > news:BAY123-F7B7ADA83D0F6862459DB2DEBF0@phx.gbl... > > %macro getnumofobs( Data = ) ; > > %Local DSID NumOfObs RC ; > > > > %Let DSID = %SysFunc( Open( &Data , I ) ) ; > > %Let NumOfObs = %SysFunc( Attrn( &DSID , NOBS ) ) ; > > %Let RC = %SysFunc( Close( &DSID ) ) ; > > > > &NumOfObs > > > > %mend getnumofobs ; > > > > I wonder how this macro is called. > I have done it this way: > %getnumofobs(data=sashelp.class) > > This is the messages from the log: > ------- > 123 %getnumofobs(data=sashelp.class) > MLOGIC(GETNUMOFOBS): Beginning execution. > MLOGIC(GETNUMOFOBS): Parameter DATA has value sashelp.class > MLOGIC(GETNUMOFOBS): %LOCAL DSID NUMOFOBS RC > MLOGIC(GETNUMOFOBS): %LET (variable name is DSID) > SYMBOLGEN: Macro variable DATA resolves to sashelp.class > MLOGIC(GETNUMOFOBS): %LET (variable name is NUMOFOBS) > SYMBOLGEN: Macro variable DSID resolves to 5 > MLOGIC(GETNUMOFOBS): %LET (variable name is RC) > SYMBOLGEN: Macro variable DSID resolves to 5 > SYMBOLGEN: Macro variable NUMOFOBS resolves to 19 > NOTE: Line generated by the macro variable "NUMOFOBS". > 1 19 > -- > 180 > MPRINT(GETNUMOFOBS): 19; > > ERROR 180-322: Statement is not valid or it is used out of proper order. > > MLOGIC(GETNUMOFOBS): Ending execution. > ----------------- > What have I done wrong since I get the error message at the bottom of the > log. > > Rune >


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