The SAS Output Delivery System and reporting techniques

Calculate volatility

Not applicable
Posts: 0

Calculate volatility

I got customer data for 24 months and their booking data. i need to find their volatility based on their median as follows processor . i been asked

Summarise data to partner, month, booknet (table1)

2. Calculate median booknet for each customer

3. Create a table containing customer, booknet_median (table2)

4. Merge table1 and table 2 (into table3), create fields

a. ‘vola’ = booknet/booknet_median*100,

b. vola_75_125 = if index between 75 and 125 then 1 else 0

5. Summarise table3 by customer, sum vola_75_125 (table 4)

6. Calculate volatility as sum vola_75_125/24%

so for i used proc summey an d i am stucked at ' a' can any one help me out

Posts: 9,364

Re: Calculate volatility

Posted in reply to deleted_user
This is not really an ODS or Base Reporting procedure (PRINT, REPORT, TABULATE) question. Although, 5 could be done by any of the above procedures; report 6 probably is best done with PROC REPORT.

You can either create your fields as part of the merge that creates table 3 or in a separate query, after table 3 is created.

Then, once that you have table 3, you can work on the report tasks 5 . Here's an example of a few reports using

ods listing;
proc print noobs n;
title '5) Detail Listing with Sum';
by region;
var region product sales;
sum sales;

proc tabulate f=8.2;
title '5) Summary Report with Grand Total and Percents';
class region product;
var sales returns;
table region all, n pctn;
table product all, n pctn;
table region all, sales* (n pctn sum*f=comma12. pctsum);
table product all, sales* (n pctn sum*f=comma12. pctsum);

#6 doesn't exactly look like a report -- but maybe it is. It looks like you only want the calculation to be done on the 0/1 field that you set in b. Here's a possible solution using a DATA step and PROC REPORT:
data calcvar;
where product in ('Slipper', 'Sandal', 'Boot');
if product = 'Slipper' then numvar = 0;
else if product = 'Boot' then numvar = 0;
else numvar = 1;

proc report data=calcvar nowd;
title '6) One Possible Solution';
where product in ('Slipper', 'Sandal', 'Boot');
column region product sales inventory numvar ;
define region / group;
define product / group;
define sales / sum;
define inventory / sum;
define numvar / sum;
break after region / summarize skip;
compute after region;
divnum = numvar.sum / .24;
line 'The number is: ' divnum comma8.2;

For further help, you might consider looking at the SAS documentation or contacting Tech Support.

Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation