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:         Mon, 26 Apr 2004 13:58:51 -0400
Reply-To:     "Fehd, Ronald J. (PHPPO)" <rjf2@CDC.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Fehd, Ronald J. (PHPPO)" <rjf2@CDC.GOV>
Subject:      Re: Reverse PROC CONTENTS
Comments: cc: jim.groeneveld@VITATRON.COM
Content-Type: text/plain; charset="us-ascii"

Perhaps the following idea is what is wanted:

*this step is relatively easy to read from a text file; DATA Structure; attrib VarA length = <$> 8 label = 'VarA label' ...; stop;

or infile Structure '...'; DATA _Null_; attrib Name length = $ 32 Type length = $ 1 Length length = 4 Format length = $ 32 Label length = $ 40 ... ; call execute('DATA <Library.>Structure ...;attrib '); infile Structure pad lrecl = 72; input @1 Name ...; if Type eq some interesting value then TypeStr = '$' else TypeStr = ' '; attribute = trim(Name) !! ' length = ' !! TypeStr !! Length !! ' format = ...; call execute(Attribute); *at end of file read: call execute(';stop;run;'); stop; run;

DATA Child; if 0 then set <Library.>Structure; do until(EndoFile); *set SomeOtherData end = EndoFile or input etc.; end;%*read loop; stop;

there is an SQL sentence something like: create table X like Y meaning create table X with same data structure as Y

Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov

--> cheerful provider of UNTESTED SAS code from the Clue?Gee!Wrx <--

If you want creative workers, give them enough time to play. -- John Cleese, comic actor (1939- ) ... or write one data structure for many data sets

> From: Groeneveld, Jim [mailto:jim.groeneveld@VITATRON.COM] > Maybe I'm missing something, but I am looking for some kind > of reverse PROC CONTENTS. I read ascii data and don't want to > enter the metadata (variable labels and many other > attributes) by hand by writing a piece of data step code. The > information is avaliable in another ascii file, which I would > like to read using the standardized variable names from PROC > CONTENTS (into a > dataset) and feed back to a (still empty) dataset, just like > the CNTLIN option with PROC FORMAT allows for importing > formats from a dataset. If that is not possible I would could > read the metadata to generate normal data step code to > %include, but that is more work. >


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