Hello everyone,
I am beginner in SAS
I have this table
SNAPSHOT | COUNT | SEGMENT | GROUP | def | GRADE |
201401 | 4472 | PRK_LNPL | 0 | 0 | 1 |
201401 | 8691 | PRK_LNPL | 0 | 0 | 2 |
201401 | 8289 | PRK_LNPL | 0 | 0 | 3 |
201401 | 2209 | PRK_LNPL | 0 | 0 | 4 |
201401 | 1450 | PRK_LNPL | 0 | 0 | 5 |
201401 | 1333 | PRK_LNPL | 0 | 0 | 6 |
201401 | 364 | PRK_LNPL | 0 | 0 | 7 |
201401 | 133 | PRK_LNPL | 0 | 0 | 8 |
201401 | 4 | PRK_LNPL | 0 | 1 | 1 |
201401 | 22 | PRK_LNPL | 0 | 1 | 2 |
201401 | 81 | PRK_LNPL | 0 | 1 | 3 |
201401 | 61 | PRK_LNPL | 0 | 1 | 4 |
201401 | 67 | PRK_LNPL | 0 | 1 | 5 |
201401 | 161 | PRK_LNPL | 0 | 1 | 6 |
201401 | 122 | PRK_LNPL | 0 | 1 | 7 |
201401 | 130 | PRK_LNPL | 0 | 1 | 8 |
201401 | 11642 | PRK_LNPL | 1 | 0 | 1 |
201401 | 19361 | PRK_LNPL | 1 | 0 | 2 |
201401 | 15284 | PRK_LNPL | 1 | 0 | 3 |
201401 | 3463 | PRK_LNPL | 1 | 0 | 4 |
201401 | 2056 | PRK_LNPL | 1 | 0 | 5 |
201401 | 1895 | PRK_LNPL | 1 | 0 | 6 |
201401 | 490 | PRK_LNPL | 1 | 0 | 7 |
201401 | 153 | PRK_LNPL | 1 | 0 | 8 |
201401 | 9 | PRK_LNPL | 1 | 1 | 1 |
201401 | 59 | PRK_LNPL | 1 | 1 | 2 |
201401 | 141 | PRK_LNPL | 1 | 1 | 3 |
201401 | 98 | PRK_LNPL | 1 | 1 | 4 |
201401 | 114 | PRK_LNPL | 1 | 1 | 5 |
201401 | 218 | PRK_LNPL | 1 | 1 | 6 |
201401 | 189 | PRK_LNPL | 1 | 1 | 7 |
201401 | 180 | PRK_LNPL | 1 | 1 | 8 |
I want this table
SNAPSHOT | COUNT | SEGMENT | GROUP | def | GRADE | SUM | DR |
201401 | 4472 | PRK_LNPL | 0 | 0 | 1 | 4476 | |
201401 | 8691 | PRK_LNPL | 0 | 0 | 2 | 8713 | |
201401 | 8289 | PRK_LNPL | 0 | 0 | 3 | 8370 | |
201401 | 2209 | PRK_LNPL | 0 | 0 | 4 | 2270 | |
201401 | 1450 | PRK_LNPL | 0 | 0 | 5 | 1517 | |
201401 | 1333 | PRK_LNPL | 0 | 0 | 6 | 1494 | |
201401 | 364 | PRK_LNPL | 0 | 0 | 7 | 486 | |
201401 | 133 | PRK_LNPL | 0 | 0 | 8 | 263 | |
201401 | 4 | PRK_LNPL | 0 | 1 | 1 | 0,089% | |
201401 | 22 | PRK_LNPL | 0 | 1 | 2 | 0,252% | |
201401 | 81 | PRK_LNPL | 0 | 1 | 3 | 0,968% | |
201401 | 61 | PRK_LNPL | 0 | 1 | 4 | 2,687% | |
201401 | 67 | PRK_LNPL | 0 | 1 | 5 | 4,417% | |
201401 | 161 | PRK_LNPL | 0 | 1 | 6 | 10,776% | |
201401 | 122 | PRK_LNPL | 0 | 1 | 7 | 25,103% | |
201401 | 130 | PRK_LNPL | 0 | 1 | 8 | 49,430% | |
201401 | 11642 | PRK_LNPL | 1 | 0 | 1 | 11651 | |
201401 | 19361 | PRK_LNPL | 1 | 0 | 2 | 19420 | |
201401 | 15284 | PRK_LNPL | 1 | 0 | 3 | 15425 | |
201401 | 3463 | PRK_LNPL | 1 | 0 | 4 | 3561 | |
201401 | 2056 | PRK_LNPL | 1 | 0 | 5 | 2170 | |
201401 | 1895 | PRK_LNPL | 1 | 0 | 6 | 2113 | |
201401 | 490 | PRK_LNPL | 1 | 0 | 7 | 679 | |
201401 | 153 | PRK_LNPL | 1 | 0 | 8 | 333 | |
201401 | 9 | PRK_LNPL | 1 | 1 | 1 | 0,077% | |
201401 | 59 | PRK_LNPL | 1 | 1 | 2 | 0,304% | |
201401 | 141 | PRK_LNPL | 1 | 1 | 3 | 0,914% | |
201401 | 98 | PRK_LNPL | 1 | 1 | 4 | 2,752% | |
201401 | 114 | PRK_LNPL | 1 | 1 | 5 | 5,253% | |
201401 | 218 | PRK_LNPL | 1 | 1 | 6 | 10,317% | |
201401 | 189 | PRK_LNPL | 1 | 1 | 7 | 27,835% | |
201401 | 180 | PRK_LNPL | 1 | 1 | 8 | 54,054% |
In column SUM i need to sum values in column COUNT for each grade and group seperatedly example 4476=4472+4.
In column DR i need to divide value from column COUNT and SUM for each grade and group seperatedly and only there where is in column DEF value=1. example 0,089%=4/4476.
Is here anybody who can solve my problem?
Use proc summary with class group grade;
Then remerge the results with your dataset, and set variables according to def.
If you want fitting code, please post your dataset in a data step so we can fit the code to the data.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.