Reputation: 41
My boss would like me to create a chart and table in SAS similar to something you can produce in excel, where the data table sits below the chart. This would mean using the data on the x-axis and placing more data below it.
Desired output
(chart area) (Row 1) Building 1 Building 2 Building 3 Building 4 (Row 2) 333 267 234 235 (Row 3) 3232 213 3215 657
I'm not sure how to do this in proc report, where the data runs long, instead of wide. Also, the data set is long:
Building ID var1 var2
Building 1 333 3232
Building 2 267 213
Upvotes: 0
Views: 961
Reputation: 63424
CarolinaJay's suggestion of a PROC GCHART or SGPLOT or whatnot followed by another proc is the way to go, IMO; while you could do both at once, it's a lot more work to do so.
To accomplish your specific table, I recommend PROC TABULATE; it doesn't care what direction your data goes.
data have;
informat buildingID $12.;
input BuildingID $ var1 var2;
datalines;
Building1 333 3232
Building2 267 213
;;;;
run;
proc tabulate data=have;
class buildingID;
var var1 var2;
tables (var1 var2)*sum=' ', buildingID=' ';
run;
Plop that under a plot, and you have something like this (I have no idea how to plot this so I just picked something totally at random):
ods _all_ close;
ods html;
data have;
informat buildingID $12.;
input BuildingID $ var1 var2;
datalines;
Building1 333 323
Building2 267 213
;;;;
run;
proc sgplot data=have;
vbar var1/response=var2 group=buildingID;
run;
title;
proc tabulate data=have;
class buildingID;
var var1 var2;
tables (var1 var2)*sum=' ', buildingID=' ';
run;
ods html close;
Upvotes: 0