Creating a function for median
2 views (last 30 days)
I have a code that helps me calculate the median by SIC code that I'd like to modify to be able to use it as a function.
SICcode = xlsread('G-Score','Active','C3:C11');
ROA = xlsread('G-Score','Active','D3:D11');
SIC = [SICcode(:), ROA(:)];
tSIC.Industry = fix(tSIC.SIC/100);
tSIC = tSIC(:,[1 end 2]);
So, with this code I am able to compute the median of an industry by the first 2 digit of the SIC code.
The things is I'd like to make a function that will helps me with two things:
- Compute the ROA for more than one year, in this case 23 in total.
- Create a function that will let me do the same thing for differents statistics (ROE, Total Assets, CFO...), in this case about 20 in total.
I know it doesn't need "a lot" of work to create a function with this code but at this point I can't make it works.
Any helps would be appreciated.