I would like to reproduce the output of PROC MEANS using PROC TABULATE. The reason for this is that I would like to have a percentage of profit (or margin) as one of the variables in the output of PROC MEANS, but I would like to suppress the calculation for one or more statistics, i.e. There will be a “- 'or similar in the string“ margin ”under“ N ”and“ SUM ”.
Here is an example of data:
data have; input username $ betdate : datetime. stake winnings; dateOnly = datepart(betdate) ; format betdate DATETIME.; format dateOnly ddmmyy8.; datalines; player1 12NOV2008:12:04:01 90 -90 player1 04NOV2008:09:03:44 100 40 player2 07NOV2008:14:03:33 120 -120 player1 05NOV2008:09:00:00 50 15 player1 05NOV2008:09:05:00 30 5 player1 05NOV2008:09:00:05 20 10 player2 09NOV2008:10:05:10 10 -10 player2 15NOV2008:15:05:33 35 -35 player1 15NOV2008:15:05:33 35 15 player1 15NOV2008:15:05:33 35 15 run; data want; set have; retain margin; margin = (winnings) / stake; PROC PRINT; RUN;
I calculated the statistics using PROC MEANS (for example, below), but the value for the SUM statistics for the "margin" variable does not mean anything: I would like to suppress this value. Therefore, I am trying to reproduce this table using PROC TABULATE in order to have more control over the output, but have not yet succeeded.
proc means data=want N sum mean median stddev min max maxdec=2 order=freq STACKODS; var stake winnings margin; run; proc tabulate data=want; var stake winnings margin; table stake * (N Sum mean Median StdDev Min Max); run;
I would appreciate any help with this.
source share