Hello, This is my current code: libname Example "~/my_courses/Homework/FinalHomework"; data Sugar; length DistrictGroup $ 30; infile '~/my_courses/Homework/FinalHomework/CaneData2.csv/' dsd firstobs=2; input District $ DistrictGroup $ DistrictPosition $ SoilID SoilName $ Area Variety $ Ratoon $ Age HarvestMonth HarvestDuration TonnHect Fibre Sugar Jul96 Aug96 Sep96 Oct96 Nov96 Dec96 Jan97 Feb97 Mar97 Apr97 May97 Jun97 Jul97 Aug97 Sep97 Oct97 Nov97 Dec97; ; run; data SugarLong; set Sugar; array mon{*} _numeric_; do _n_=9 to dim(mon); Month=vname(mon[_n_]); Count=mon[_n_]; output; end; drop Month DistrictGroup SoilID SoilName Area Variety Ratoon Age HarvestMonth HarvestDuration TonnHect Fibre Sugar Jul96 Aug96 Sep96 Oct96 Nov96 Dec96 Jan97 Feb97 Mar97 Apr97 May97 Jun97 Jul97 Aug97 Sep97 Oct97 Nov97 Dec97; run; data SugarLongResult; set SugarLong; select; when (Count > 0) Result='Yes'; otherwise Result='No'; end; Proc print data=SugarLongResult (obs=50); var District DistrictPosition Result; print; proc sort data=SugarLongResult out=SugarLongResultDupe NODUPKEY; by District DistrictPosition Result; run; proc freq data=SugarLongResultDupe; tables DistrictPosition* Result / out=SugarLongResultFinal; run; proc print data=SugarLongResultFinal; run; There are only 15 District options but the output is currently adding up to 20. The problem seems to be with S, W, and C, it looks like it's including the count of No in both No and Yes. The correct numbers are below: DistrictPosition Result Count N Yes 2 N No 0 E Yes 2 E No 0 S Yes 0 S No 2 W Yes 4 W No 2 C Yes 2 C No 1 This is the current output which is almost correct:
... View more