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 (October 2007, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 1 Oct 2007 08:33:06 -0700
Reply-To:   gealnidk <adsense@FAMNISSEN.DK>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   gealnidk <adsense@FAMNISSEN.DK>
Organization:   http://groups.google.com
Subject:   Re: Data rearrangement
Comments:   To: sas-l@uga.edu
In-Reply-To:   <1191244902.080587.47650@g4g2000hsf.googlegroups.com>
Content-Type:   text/plain; charset="us-ascii"

If for some reason you wont use proc means or you want to do more complex transformations, you could use a simple data step to solve your problem ;-) Please refine the code yourself, this is just a simple and quick hack.

data diag; input @1 Diag0 @9 Diag1 @17 Diag2 @25 date $9.; datalines; 1 0 0 05-Oct-98 0 1 0 05-Oct-98 1 0 0 06-Oct-98 0 1 0 06-Oct-98 0 1 0 06-Oct-98 1 0 0 06-Oct-98 1 0 0 06-Oct-98 0 1 0 06-Oct-98 1 0 0 10-Oct-98 0 1 0 11-Oct-98 1 0 0 12-Oct-98 0 1 0 12-Oct-98 0 0 1 13-Oct-98 1 0 1 13-Oct-98 0 0 0 13-Oct-98 ; run;

proc sort data=diag; by date; run;

data outout(keep=date all_admissions sum_diag0-sum_diag2); set diag(keep=date diag0-diag2); by date; if first.date then do; all_admissions=0; sum_Diag0=0; sum_Diag1=0; sum_Diag2=0; end; all_admissions+1; sum_Diag0+Diag0; sum_Diag1+Diag1; sum_Diag2+Diag2; if last.date then output; run;


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