/****************************************************************/ /* S A S S A M P L E L I B R A R Y */ /* */ /* NAME: hpds2 */ /* TITLE: Example 2 for PROC HPDS2 */ /* Run DS2 Code on Grid - Aggregate Result Data Set */ /* PRODUCT: HPA */ /* SYSTEM: ALL */ /* KEYS: DS2 code */ /* PROCS: HPDS2 */ /* DATA: */ /* */ /* SUPPORT: */ /* REF: SAS/HPA User's Guide, PROC HPDS2 chapter */ /* MISC: */ /* */ /****************************************************************/ libname applianc &ENGINE server = "&GRIDDATASERVER" user = &USER password = &PASSWORD database = &DATABASE; data obj_dims; do id=1 to 200; radius = ranuni(1) * 10; height = ranuni(1) * 20; output; end; run; %let pi=3.14159; proc hpds2 data=obj_dims out=applianc.obj_comps; performance host="&GRIDHOST" install="&GRIDINSTALLLOC"; data DS2GTF.out; method run(); set DS2GTF.in; volume = &pi * radius**2 * height; area = (2 * &pi * radius**2) + (2 * &pi * radius * height); end; enddata; run; proc print data=applianc.obj_comps (obs=20); title1 'Volumes and Areas'; run; data obj_comps; set applianc.obj_comps; run; proc ds2; data obj_totals (keep = (ncount vsum asum vmean amean)); dcl double ncount vsum asum vmean amean; method init(); ncount = 0; vsum = 0; asum = 0; end; method run(); set {select volume, area from obj_comps}; ncount + 1; vsum + volume; asum + area; end; method term(); if ncount ne 0 then do; vmean = vsum/ncount; amean = asum/ncount; end; output; end; enddata; run; quit; proc print data=obj_totals; title1 'Total Volume and Area'; run;