Hi, this should be simple but I am struggling. I have a dataset with 2 variables - service item and a count. Included in the service item variable I have also created a record called Total (which is the sum of all service items) . What I want to do, is create a 3rd variable on every record that uses thetotal value I created. So, what I want is 3 variables and every record will have Service item, count, and Grand total (as a new variable). ie serviceitemcd Count GrandTotal AB 10 60 AC 20 60 AD 30 60 Total 60 60 I have tried doing a data merge where the total is in one data set and the service items and count is in another dataset. But when I do this, it creates a value for the Total Grand Total record but the other service items the Grand total is missing. This is my code. Thanks for your help.. proc summary data = physio_recd nway; class serviceitemcd; var INVOICE_AM; output out=dat.physio_item (drop=_type_ _freq_) n=count; proc summary data = physio_recd nway; class; var INVOICE_AM; output out=physio_tot (drop=_type_ _freq_) n=GrandTotal; data physio_tot; set physio_tot; SERVICE_ITEM_CD = 'ZZTotal'; count = GrandTotal;; proc sort data = dat.physio_item; by SERVICE_ITEM_CD; proc sort data = physio_tot; by SERVICE_ITEM_CD; data dat.physio_item; merge dat.physio_item physio_tot;
... View more