05-11-2015 05:11 AM
I have the dataset reports with proc reports:
info CW is calendar-week
But I want to have the report like decision tree diagram:
And so, for15W01, 15W02, 15W03, ….
I have only SAS BASE 9.4.
Can anyone know how to get this Report? Any help would be greatly appreciated.
05-11-2015 11:09 AM
There are other procedures for SAS that do decision trees, but your example doesn't look like modeling. It looks more like a nested summary report. PROC REPORT and PROC TABULATE will both do summary reports, but won't "skip" variables on rows the way you show (such that VAR1 is in the middle. But, here's an example of what TABULATE would do for you (showing 15W01 only):
And, here's an example of what REPORT would do for you:
But of course, since you didn't post any input data, I had to make some fake data. So the structure of your input data will make a difference to the final code for you. For example, given that you said this was weekly data, I made a fake "DAY" variable, which you might not have in your data.
SAS does have procedures that do decision trees (PROC DTREE), but that is more for modeling than what you seem to show (simple SUM).
05-11-2015 01:27 PM
Thanks a lot for your support. Maybe my text was not clear. here is the data for only CW 15W01
input CK $ VAR1 VAR2 VAR3 SUM;
15W01 0 0 0 120
15W01 0 1 0 300
15W01 0 1 1 15
15W01 1 0 0 20
15W01 1 1 0 2
15W01 1 1 1 3
with proc report I have this table like your proc report table
But I want to have this table.I want have SUM for every variable or class
I can do with 3 different proc report table. but I must do or show only one proc report table.
05-11-2015 06:58 PM
That is rather dicey to produce, since the header values are placed in PROC REPORT header cells, one row at a time. So, at the point in time AFTER the VAR1 has been written on header row 1 and AFTER the 1 and 0 have been written on header row 2, there is no visibility of the value that was just written in the previous row in order to write the 435 and the 25. So that will be a challenge you might get around with some kind of macro programming. But I do not think that this is really possible with PROC REPORT without at LOT of pre-processing of the data or the report. If you have presummarized all the totals, you might be able to do this with a custom TABLE template or with the Report Writing interface and a DATA step. But really, I am doubtful that PROC REPORT will be able to give you what you want. You might want to check with Tech Support before you start investigating other technology, though.