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 2009, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 1 Oct 2009 04:54:38 -0400
Reply-To:     Thien Thai <coithienthai2002@YAHOO.COM.AU>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Thien Thai <coithienthai2002@YAHOO.COM.AU>
Subject:      Re: Help with the sum of combinations

Hi Mark, I now understand what all the fuss is about, my question somehow similar to the previous poster. I can however assure you that my question posed is definitely not a class assignment as i'm dealing with gigabytes of data. Saying that I have now worked out a way, but it's not quite hunky dory yet and taking too much I/O and also not in the format I intended and scalable to include more partners.

Kind Regards

proc sort data=grocery.met_tab; by id; run;

proc summary data=grocery.met_tab nway; var expenditure; class id partner/ MISSING ORDER=data; output out=grocery.meta_tab1 (drop= _TYPE_ _FREQ_ rename=(expenditure_Sum=expenditure_tot expenditure_N=exp_count)) SUM= N=/ autoname; run;

data grocery.meta_tab1; set grocery.meta_tab1; count+1; by id; if first.id then count=1; run;

data grocery.meta_tab2; set grocery.meta_tab1; by id; if last.id and count = 1 then flag='1partner'; else flag='mt1partner'; run;

/*Checking*/ data grocery.1partner grocery.mt1partner; set grocery.meta_tab1; by id; if last.id and count = 1 then do; flag='1partner'; output grocery.1partner; end; else do; flag='mt1partner'; output grocery.mt1partner; end; run;

/*More checking*/ proc freq data=grocery.meta_tab2; table flag/nopercent nocum; run;

proc tabulate data=grocery.meta_tab2 out=grocery.meta_tab2a (drop=_TYPE_ _TABLE_ _PAGE_) missing style=[background=beige]; class partner / style=[foreground=blue]; class flag / style=[foreground=green]; keylabel sum=' '; keyword all / style=[font_weight=light font_style=italic foreground=red]; var expenditure_tot exp_count; tables partner,flag*(expenditure_tot exp_count)*(sum n); run;


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