Date: Mon, 7 Jul 2008 13:59:28 -0400
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Patrice Bourdages <patrice.bourdages@DESJARDINS.COM>
Subject: RE SET with OBS=0
Content-Type: text/plain; charset="ISO-8859-1"
You might try the following :
where libname = upcase("LibraryName") and
memname = upcase("SASDatasetsName");
%put nobs = &_m_Nobs.;
Substitute with whatever information you need, insert your LibraryName and
SASDatasetsName in order for the query to work.
This will provide you the with the number of Obs without even opening of
touching the SAS Datasets. It is fast, reliable and provides the
information in a blink of an eye.
Hope this helps ...
"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> a écrit sur 2008-07-07
> I was experimenting with the following code in SAS 9.01.01M3P020206 on
> %let obsn=0;
> data _null_;
> set myds (obs=&obsn.) nobs=nobs;
> put nobs=;
> call symput ("nobs",nobs);
> %put nobs = &nobs.;
> The put statement produced no output and the %put issued a warning that
> nobs did not resolve. If I change macro variable obsn to 1 then
> everything works okay. I wanted to use SET with OBS=0 as a way of
> some information, like the number of observations, without actually
> reading any observation information into the data vector. Obviously,
> there are alternatives, such as OPEN and ATTRN, but my questions are:
> Is there a way to get the number of observations from SET and OBS=0 (in
> other words, did I do something wrong)?
> What information can you get from SET and OBS=0, if anything?
> -- TMK --
> "The Macro Klutz"