Date: Mon, 16 Apr 2007 13:18:33 -0700
Reply-To: saslearn007@GMAIL.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: saslearn007@GMAIL.COM
Organization: http://groups.google.com
Subject: Re: arrays
In-Reply-To: <B89C5B3C26FDEF4CA2BCBFAFC411AF8202ECB110@PFGDSMMBX015.principalusa.corp.principal.com>
Content-Type: text/plain; charset="iso-8859-1"
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.
|