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 (April 2004, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 28 Apr 2004 13:35:31 -0400
Reply-To:     Bruce Johnson <bjohnson@SOLUCIENT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Bruce Johnson <bjohnson@SOLUCIENT.COM>
Subject:      Re: PROC CONTENTS or DATASETS--Easy question
Comments: To: Tracy Haidar <thaida1@UMBC.EDU>
Content-Type: text/plain; charset="us-ascii"

Here's an easy way, but not very elegant...

Proc contents data=rdata._all_ noprint out=temp; Run; Proc print data=temp; var memname name varnum format nobs; Run;

That will get you the dataset name (memname), the variable name (name), the number of variables (varnum..select the highest number), the format of the variable (format), and the number of observations (nobs).

Now, you could so some fancy coding and create a report with this information as well. It all depends on how pretty it needs to be.

________________________________ Bruce A. Johnson bjohnson@solucient.com

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Tracy Haidar Sent: Wednesday, April 28, 2004 12:21 PM To: SAS-L@LISTSERV.UGA.EDU Subject: PROC CONTENTS or DATASETS--Easy question

How do I use proc contents or datasets to read in the contents of a directory and

(1) Create a printout with ONLY the data set name, #obs, #variables, and format associated with each variable (2) Create a dataset with ONLY the info in (1) above?

I've been experimenting with various options with both proc contents and proc datasets, but I'm getting too little or too much info rather than JUST the info in (1) above. This can't be too hard! Can someone advise me on the propoer options to use with either of these PROCs to get the info I need?

For example, I am reading in the contents of an Access database. When I use the following:

libname rdata odbc dsn= rdata_1;

proc contents directory data= rdata._all_ out=temp ; run;

I get WAY more info in both the output and the data set than I need. Also, in the data set #obs is missing (not sure why) and #variables isn't included (instead each variable is listed).

Adding other options to this so far hasn't given me what I'm looking for...

Thanks,

Tracy This message is a private communication. It may contain information that is confidential and legally protected from disclosure. If you are not an intended recipient, please do not read, copy or use this message or any attachments, and do not disclose them to others. Please notify the sender of the delivery error by replying to this message, and then delete it and any attachments from your system. Thank you, Solucient LLC (rev eXclaimer 2x)


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