Date: Fri, 29 Sep 2006 13:30:39 -0400
Reply-To: Steven Raimi <steven_raimi@POLK.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Steven Raimi <steven_raimi@POLK.COM>
Subject: Re: How to obtain obs or _N_ using SQL
Total number of records in the dataset - Mark Terjeson pointed out select
count('x').
Obs number for each row - if that's what you want, there's no reliable way
to get it from SQL. There are functions that will imitate the obs number
(search the archives for "monotonic" to find previous discussions on this
topic), but SQL will not guarantee to get any dataset in the same order
twice (except when you're doing an "order by", but that's applied after
the records have been retrieved).
Steve Raimi
R.L. Polk & Co.
|