Hi, I hope this meets your requirement: data have; input School_ID $ Enrolments Females LowSES Black Secondary_Education ; datalines; 1 30 60 33 0 80 2 200 50 12 15 59 3 111 100 80 80 100 4 80 0 15 26 25 5 20 100 25 3 59 All 441 65 33 25 65 ; /*Solution*/ data _null_; if (_n_ = 1) then do; if 0 then set have; declare hash myhash(); rc = myhash.definekey('School_ID'); myhash.definedata('School_ID','Enrolments','Females','LowSES','Black','Secondary_Education'); myhash.definedone(); end; set have end=last; rc=myhash.clear(); if _n_=1 then set have( where=( _School_ID='All') rename=(School_ID=_School_ID Enrolments=_Enrolments Females=_Females LowSES=_LowSES Black=_Black Secondary_Education=_Secondary_Education )); array s(*) Enrolments--Secondary_Education; array _s(*) _Enrolments--_Secondary_Education; rc=myhash.add(); School_ID=_School_ID; do i=1 to dim(s); s(i)=_s(i); end; rc=myhash.add(); if not last then rc=myhash.output(dataset:'school'||left(_n_)); drop rc _:; run; Regards, Naveen Srinivasan
... View more