Date: Thu, 11 Apr 2002 17:07:01 -0400
Reply-To: "Fehd, Ronald J." <rjf2@CDC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Fehd, Ronald J." <rjf2@CDC.GOV>
Subject: Re: SQL and number of records
Content-Type: text/plain
> From: Action Man [mailto:wollo_desse@HOTMAIL.COM]
> I need to know number of records is a data set. I mean, we
> use _N_ in base
> SAS. Do we have such capability is SQL sas? I tried to use
> count, but count
> does not do the action I want. It count all records and gave
> me the total
> records per subject. Is the an _N_ function in SAS SQL?
run this:
PROC SQL ;describe table DICTIONARY.TABLES;quit;
This is snipped from a macro
%LET MEMNAME = WHATEVER;
%LET LIBRARY= WORK;
%LET LIBRARY= LIBRARY;
%LET MEMNAME = %UPCASE(&MEMNAME.);
%*local NOBS MEMLABEL;
PROC SQL noprint;
select nobs, memlabel
into :NOBS, :MEMLABEL
from DICTIONARY.TABLES
where LibName eq "&LIBRARY."
and upcase(MemName) eq upcase("&MEMNAME.")
;quit;
%LET NOBS =&NOBS.; %*remove spaces;
%LET MEMLABEL =&MEMLABEL.;%*remove spaces;
%PUT MEMNAME<&MEMNAME.> NOBS<&NOBS.> MEMLABEL<&MEMLABEL.> ;
remove the references to MEMLABEL and you're home free.
Ron Fehd the SQL into:macro maven CDC Atlanta GA USA RJF2@cdc.gov
OpSys: Win_Pro Ver: 8.2
--> cheerful provider of TESTED SAS code from the Clue?Gee!Wrx <--