| Date: | Tue, 18 Jun 1996 22:01:10 -0600 |
| Reply-To: | Andrew James Llwellyn Cary <ajlcary@IX.NETCOM.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU> |
| From: | Andrew James Llwellyn Cary <ajlcary@IX.NETCOM.COM> |
| Organization: | Cary Consulting Services |
| Subject: | Re: Extracting var length and format |
|---|
Michael Little wrote:
>
> Hi,
>
> Is there any method similar to the CALL LABEL() routine to find the
> length of a SAS variable (both char and numeric) and any date format
> that was permanently associated with numeric vars? I suppose I can
> always grep from a Proc Contents (SAS 6.11 for AIX), but I'd like a more
> elegant way. (Or is it just soooo simple and I don't see it?)
>
> Thanks,
> Mike
>
> --
> Michael Little, Social Science Computing
> 353 McNeil, phone: 215-573-3331, 215-898-6454
> little@ssc.upenn.edu
First, let's leave GREP at home. Some day you may wish to run SAS code
on a whole operating system. ;)
Both PROC CONTENTS and PROC DATASETS will produce an output dataset with
the all the information you have requested (plus tons you didn't).
PROC CONTENTS DATA=yourdata NOPRINT OUT=directry;
RUN;
My perferred way is to use the Dictionary.columns tabel with PROC SQL to
get the information.
PROC SQL;
SELECT NAME, LABEL, LENGTH, TYPE, FORMAT FROM DICTIONARY.COLUMNS
WHERE MEMNAME=yourdata;
--
Andrew J. L. Cary | I Reckon that the Opinions
Senior Curmudgeon | expressed here DO represent
Cary Consulting Services, Newark, CA | those of the management of
ajlcary@ix.netcom.com | Cary Consulting Services
|