|Date: ||Mon, 20 Dec 1999 17:22:06 -0600|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||Shiling Zhang <shiling@MATH.WAYNE.EDU>|
|Organization: ||Wayne State University|
|Subject: ||Re: SPSS Aggregate vs SAS ___?|
|Content-Type: ||text/plain; charset=us-ascii|
Proc transpose will do the trick.
Hope this helps.
*the example assume the data is sorted by projid clientid;
do projid=1 to 6;
do clientid =1 to 3;
do i=1 to repeat;
keep projid clientid admitdt;
proc transpose data=t1 output=t2(drop=_name_) prefix=addt;
by projid clientid ;
proc print; format addt1-addt5 format mmddyy10.; run;
Jeremy Miller wrote:
> Dear SAS-L,
> I need to flatten a file with the following structure:
> PROJECT CLIENTID ADMITDT
> 1 001 11/30/96
> 1 001 04/01/97
> 1 002 03/01/96
> 2 001 X
> 2 002 X
> .. .. ..
> .. .. ..
> N N N
> As you can see, CLIENTID can be entered more than once. I need to have one
> record per client with the earliest date as 'ADMITDT' and the next earliest
> as 'ADMITDT2' and so on for N entries.
> PROJECT CLIENTID ADMITDT ADMITDT2 ADMITDT3 ADMITDTn
> In SPSS, I would use an Aggregate procedure, which would only supply me with
> the earliest and last 'ADMITDT,' which misses cases with more than two
> /BREAK=projname clientid
> /ADMITDT= FIRST(admitdt)
> How would I go about doing this in SAS without being limited to a
> 'first/last' selection. I know everyone is busy, so just point me in the
> right direction (i.e., what procedure would be best, a manual, etc.). I am
> aware of a macro 'towide' that does something similar, is there any other
> Thanks in advance,
> Jeremy T. Miller
> Caliber Associates
> 10530 Rosehaven St.
> STE 400
> Fairfax, VA 22030
> (703) 219-4332