Looks like your math is off, not sure if this is what you want but try this: data have; infile cards dsd; input crsp_fundno begdt enddt x $ duration; cards; 139,19941230,19980629,,1277 139,19980630,19991230,,548 139,19991231,20000629,MLGE,181 139,20000630,20000831,LCGE,62 2761,19981231,19991230,,364 2761,19991231,20000629,LCGE,181 2761,20000630,20020629,LCCE,729 2761,20020630,20080330,LCGE,2100 2761,20080331,20130331,LCGE,1826 ; run; proc sql; create table start as select *,sum(duration) as SumDuration from have group by crsp_fundno; data want; set start; prop = duration / SumDuration; run;
... View more