Skip to content

Instantly share code, notes, and snippets.

@Benjit87
Created December 6, 2012 08:35
Show Gist options
  • Save Benjit87/4222767 to your computer and use it in GitHub Desktop.
Save Benjit87/4222767 to your computer and use it in GitHub Desktop.
/* Use SAS to call Java Object *
* http://benjithian.sg/2012/12/sas-with-java/ */
/* Sample Data from Google Chart API*/
data Work.test;
infile datalines missover;
input Topping $ Slices $;
datalines;
Mushroom 3
Onions 1
Olives 1
Zucchini 1
Pepperoni 2
;
run;
data _null_;
declare javaobj j("Chart");*create the Chart object;
do i = 1 to RowCount; *use direct access to get all the rows;
set Work.test Point=i nobs=RowCount;
*call the put method in Chart class to put the data;
j.callVoidMethod("put",Topping,Slices);
end;
j.callvoidmethod("write"); *write it out to a file;
stop;*need to use stop if u are using Point= else it will loop endlessly;
run;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment