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 2007, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 17 Apr 2007 06:38:56 -0500
Reply-To:   "Huang, JS" <Huang.JS@PRINCIPAL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Huang, JS" <Huang.JS@PRINCIPAL.COM>
Subject:   Re: arrays
Comments:   To: saslearn007@GMAIL.COM
In-Reply-To:   A<1176754713.238066.137320@p77g2000hsh.googlegroups.com>
Content-Type:   text/plain; charset="us-ascii"

Saslearner:

I suppose the code can be extended to 10 variables from 3. If you have probelems on this, please provide a small sample to the list.

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of saslearn007@GMAIL.COM Sent: Monday, April 16, 2007 3:19 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: arrays

On Apr 16, 3:57 pm, Huang...@PRINCIPAL.COM ("Huang, JS") wrote: > Try the following: > > data Given; > infile datalines missover; > input id $ dat1:date9. dat2:date9. dat3:date9.; > format dat1 dat2 dat3 mmddyy10.; > datalines; > a 1jan2001 > a . 1jan2002 > a . . 1jan2004 > b 2jan2001 . 3jan2001 > b . 1jan2003 > c 2jan2001 > c . . 1jan2001 > ; > > proc sql; > create table Result as > select id,max(dat1) format=mmddyy10. as NewDat1,max(dat2) > format=mmddyy10. as NewDat2, max(dat3) format=mmddyy10. as NewDat3 > from Given > group by id; > quit; > > proc print data=Result; > run; > > ***** Output ***** > 06:45

> Monday, April 16, 2007 354 > > Obs id NewDat1 NewDat2 > NewDat3 > > 1 a 01/01/2001 01/01/2002 > 01/01/2004 > 2 b 01/02/2001 01/01/2003 > 01/03/2001 > 3 c 01/02/2001 . > 01/01/2001 > > > > -----Original Message----- > From: SAS(r) Discussion [mailto:S...@LISTSERV.UGA.EDU] On Behalf Of > > saslearn...@GMAIL.COM > Sent: Monday, April 16, 2007 2:42 PM > To: S...@LISTSERV.UGA.EDU > Subject: arrays > > Dear SAS users, > > I have a data set like this > > id dat1 dat2 dat3 > a 1jan2001 > a 1jan2002 > a 1jan2004 > b 2jan2001 3jan2001 > b 1jan2003 > c 2jan2001 > c 1jan2001 > > I want to make this data set to have one record per id with all the > information available > > I am trying to do using macros or arrays. > > Could not make it work. any help will be appreciated > > thanks > > -----Message Disclaimer----- > > This e-mail message is intended only for the use of the individual or > entity to which it is addressed, and may contain information that is > privileged, confidential and exempt from disclosure under applicable law. > If you are not the intended recipient, any dissemination, distribution

> or copying of this communication is strictly prohibited. If you have > received this communication in error, please notify us immediately by > reply email to Conn...@principal.com and delete or destroy all copies > of the original message and attachments thereto. Email sent to or from

> the Principal Financial Group or any of its member companies may be > retained as required by law or regulation. > > Nothing in this message is intended to constitute an Electronic > signature for purposes of the Uniform Electronic Transactions Act > (UETA) or the Electronic Signatures in Global and National Commerce > Act ("E-Sign") unless a specific statement to the contrary is included in this message. > > While this communication may be used to promote or market a > transaction or an idea that is discussed in the publication, it is > intended to provide general information about the subject matter > covered and is provided with the understanding that The Principal is > not rendering legal, accounting, or tax advice. It is not a marketed > opinion and may not be used to avoid penalties under the Internal > Revenue Code. You should consult with appropriate counsel or other > advisors on all matters pertaining to legal, tax, or accounting > obligations and requirements.- Hide quoted text - > > - Show quoted text -

I have given an example of 3 but I have like that 10

Can I use do loop in sql or any other method.

-----Message Disclaimer-----

This e-mail message is intended only for the use of the individual or entity to which it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended recipient, any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by reply email to Connect@principal.com and delete or destroy all copies of the original message and attachments thereto. Email sent to or from the Principal Financial Group or any of its member companies may be retained as required by law or regulation.

Nothing in this message is intended to constitute an Electronic signature for purposes of the Uniform Electronic Transactions Act (UETA) or the Electronic Signatures in Global and National Commerce Act ("E-Sign") unless a specific statement to the contrary is included in this message.

While this communication may be used to promote or market a transaction or an idea that is discussed in the publication, it is intended to provide general information about the subject matter covered and is provided with the understanding that The Principal is not rendering legal, accounting, or tax advice. It is not a marketed opinion and may not be used to avoid penalties under the Internal Revenue Code. You should consult with appropriate counsel or other advisors on all matters pertaining to legal, tax, or accounting obligations and requirements.


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