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 (September 1999, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 23 Sep 1999 15:49:38 GMT
Reply-To:     charles_patridge@MY-DEJA.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         charles_patridge@MY-DEJA.COM
Organization: Deja.com - Share what you know. Learn what you don't.
Subject:      Re: Interesting problem

Dear Winston,

I had a few minutes and thought about tackling your problem.

How about this as a possible solution - simple but straight forward without any sorting or merging. Needs a bit of work to be all inclusive but I am sure someone is willing to carry my logic a step further:

Good Luck - Charles Patridge

/************************************************************/ /***TIP00092.sas ***/ /*** Author: Charles Patridge ***/ /*** PDPC, Ltd. ***/ /*** 172 Monce Road ***/ /*** Burlington, CT 06013 ***/ /*** Email: Charles_S_Patridge@prodigy.net ***/ /*** web: www.sasconsig.com ***/ /*** ***/ /*** A simple sas program to similate the OLD PROC HIER ***/ /*** rotuine back in 1985. ***/ /*** ***/ /*** This is very crude but could easily be expanded ***/ /*** upon. ***/ /*** ***/ /*** Ex: Input ***/ /*** 3209 APTY ***/ /*** 3210 APTY ***/ /*** 3212 APTY ***/ /*** 3213 ACOP ***/ /*** APTY AIMS ***/ /*** ARAF AIMS ***/ /*** ACOP QTIM ***/ /*** QTIM SIAM ***/ /*** ***/ /*** Ex: Desired Output ***/ /*** OBS VAR1 VAR2 VAR3 VAR4 VAR5 ***/ /*** 1 3209 APTY AIMS ***/ /*** 2 3210 APTY AIMS ***/ /*** 3 3212 APTY AIMS ***/ /*** 4 3213 ACOP QTIM SIAM ***/ /*** 5 APTY AIMS ***/ /*** 6 ARAF AIMS ***/ /*** 7 ACOP QTIM SIAM ***/ /*** 8 QTIM SIAM ***/ /************************************************************/

Data Test; length var1 $ 4 var2 $ 4; infile cards4; input var1 var2; cards; 3209 APTY 3210 APTY 3212 APTY 3213 ACOP APTY AIMS ARAF AIMS ACOP QTIM QTIM SIAM ;;;;

data testfmt (keep=start label fmtname); retain fmtname '$codefmt'; set test; start = var1; label = var2; run;

proc format library=work cntlin=testfmt; run;

data test1; set test ; var3 = put( var2, $codefmt. ); if var2 = var3 then var3 = ' '; var4 = put( var3, $codefmt. ); if var3 = var4 then var4 = ' '; var5 = put( var4, $codefmt. ); if var4 = var5 then var5 = ' '; run;

/*** would have to expand last datastep based upon number of ***/ /*** parent child relations you desired and I am sure a macro ***/ /*** could be devised to figure when to stop the expansion ***/

In article <000f01bf04f9$6df231a0$b103460a@winstong.absa.co.za>, Winston Groenewald <jacov@ABSA.CO.ZA> wrote: > I have a data set for which I have to produce an expanded version showing > all the possible hierarchies that may exists among two fields. My data set > looks like this > > VAR1 VAR2 > 3209 APTY > 3210 APTY > 3212 APTY > 3213 ACOP > APTY AIMS > ARAF AIMS > > and I want this > > 3209 APTY AIMS > 3210 APTY AIMS > 3212 APTY AIMS > 3213 ACOP QTIM SIAM > APTY AIMS > ARAF AIMS > ACOP QTIM SIAM > QTIM SIAM > > I have already written a macro that splits the data into different values of > VAR1 and then remerging those files by renaming VAR1 & VAR2 in data set 2 - > the message box of which is too big to write the solution - no pun intended > de Fermat) > > I have worked off a small section of the actual data set and am scared that > I may run into a 'Too many open files" error. > > Can anyone provide a more elegant solution? > > Regards > Winston Groenewald > Johannesburg, South Africa > > -----Original Message----- > From: Winston Groenewald <jacov@absa.co.za> > To: SAS-L@LISTSERV.UGA.EDU <SAS-L@LISTSERV.UGA.EDU> > Date: Friday, September 17, 1999 8:44 PM > Subject: Re: Re: Date formats > > >Apologies, I should have specified better what I meant by "complete". The > >online documentation for, specifically date formats/informats, lacks > >examples. What is very frustrating for me is having to go through the SAS > >Language guide trying to find some date format/function, especially since > >they are alphabetically sorted, just to find the result of its application. > > > >Phil Mason, back in 1995, submitted a list of date formats, complete with > >examples, which was an extremely handy and *quick* reference. > > > >As far as your question goes, I don't know. However, I have seen many > posts > >here where programmers tried to modify date variable formats to dd-mmm-yy. > >If you're familiar with Oracle (which I'm sure you are), you'll probably > ask > >yourself whether the list is complete as well. > > > >Winston Groenewald > >Johannesburg, South Africa > > > >-----Original Message----- > >From: Andreas Grueninger <grueninger@IBGRUENINGER.DE> > >Newsgroups: bit.listserv.sas-l > >To: SAS-L@LISTSERV.UGA.EDU <SAS-L@LISTSERV.UGA.EDU> > >Date: Thursday, September 16, 1999 1:17 PM > >Subject: Re: Date formats > > > > > >>>Has anyone got a complete list of date formats/informats supported by > >V6.12 > >>>handy? > >> > >>I use the help in SAS and search for "date informats" and I get a list > >>of the informats. Do you think this list is incomplete? > >>--------------------------- > >>Andreas Grueninger > >>PRIVATE: grueninger@ibgrueninger.de > >> OFFICE: grueninger@lfl.bwl.de > >>--------------------------- > > >

Sent via Deja.com http://www.deja.com/ Share what you know. Learn what you don't.


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