Hi RW9, I tried executing your code. The final structure of the output table is perfect as per the requirement but the values are dragged over observation. Also there are some unnecessary columns in final dataset. See below: data want; 1130 set test; 1131 array vol_{3}; 1132 array rev_{3}; 1133 array profit_{3}; 1134 array sp_{3}; 1135 do i=1 to 3; 1136 volume=cats("Vol_",put(i,1.)); 1137 volume_fig=vol_{i}; 1138 revenue=cats("Rev_",put(i,1.)); 1139 revenue_fig=rev_{i}; 1140 profit=cats("Profit_",put(i,1.)); 1141 profit_fig=profit_{i}; 1142 sp=cats("SP_",put(i,1.)); 1143 sp_fig=sp_{i}; 1144 output; 1145 end; 1146 run; NOTE: There were 2 observations read from the data set WORK.TEST. NOTE: The data set WORK.WANT has 6 observations and 24 variables. NOTE: Compressing data set WORK.WANT increased size by 100.00 percent. Compressed is 2 pages; un-compressed would require 1 pages. NOTE: DATA statement used (Total process time): real time 0.39 seconds cpu time 0.01 seconds But with the code i shared, we get the final table structure as well as desired values and columns perfectly. Still Your code and use of arrays is really impressive. It reduced a lot of typing work. Thanks for sharing that technique. -Rishi
... View more