11-02-2015 06:20 PM - edited 11-03-2015 07:33 PM
I have a table of 6 columns and 8760 rows filled with numerical values. I need to find 99 percentiles for each row which has 6 values.
Below is the gist of the table:
I want to calculate all the percentiles for each row for combined six values.
Ex: For first row, I want the 99 percentiles of the values
Similarly for each row.
I have tried proc univariate for this purpose, the result is not for every row but for every column. Hence I tried transposing the table but SAS can't take 8760 variables at a time.
Kindly suggest a solution.
Thanks a lot in advance.
11-02-2015 07:59 PM
i believe we need to transpose data to columns and then use proc means to calculate the percentile
data have; input Load_04 Load_05 Load_06 Load_07 Load_08 Load_09; cards; 2433.896 2323.323 2720.163 2708.686 2742.605 2925.509 2381.1 2299.548 2649.212 2576.808 2638.918 2717.989 2421.829 2376.882 2595.548 2474.217 2604.292 2749.657 2485.082 2487.375 2595.651 2434.356 2579.163 2728.158 2559.993 2573.468 2607.336 2459.65 2602.624 2795.224 ; proc transpose data=have out=want; var Load_04 Load_05 Load_06 Load_07 Load_08 Load_09; run; proc means data= want ; var col1-col5; output out=p99 p99=/autoname; run;
11-03-2015 06:45 PM
Thank you for the asnwer. This seems very helpful.
Could you please tell me what does the function
What does load(*) stand for?
Kindly reply as per your convenience.
11-03-2015 10:29 PM
array load(*) load:;
load is name of array and (*) indicates the dimension of array, represents number of elements in the array which is 6 in this case. If we indicate dimension of the array using (*) then SAS determines demension of the array by counting number of elements.
load: represents 6 elements in the array (load1 load2 load3 load4 load5 load6)
array load(*) load:;
can also be written as
array load(6) load1 load2 load3 load4 load5 load6;
11-03-2015 10:25 AM
11-03-2015 12:47 PM
As Reeza pointed out, this exercise doesn't make sense. In general, you need more than 100 values before the 99th percentile becomes meaningful. It looks like your data does not contain duplicate or rounded values, so the only relevant percentiles are 16.6th, 33.3th,...,and 87.6th. If you want the max of each row, that is easy to do with the DATA step and an array.
11-04-2015 11:33 AM
11-09-2015 04:33 PM
Sincere apologies for a delayed reply.
I was implemented this scenario in excel, the values weren't similar. I almost got 99 different values when I used the PERCENTILE.INC function over the 6 variables I mentioned earlier in the post.
Another point, would the logic be same if I want to get 100 percentiles of 20 variables instead of 6? 6 was just an example.
11-09-2015 04:48 PM
11-20-2015 10:20 PM
I am in situation where I have more than 99 values and I need calculate the 99 percentiles of each of set of values. The table consists of 8760 rows and more than 100 columns.
I need to calculate 99 percentiles for each row.
Kindly revert as per your convenience.
11-21-2015 01:35 PM