id | sale |
101 | 5 |
101 | 14 |
101 | . |
102 | 45 |
102 | 78 |
102 | 58 |
102 | 69 |
102 | 89 |
102 | . |
assign sum id wise into missing values like see below
id | new |
101 | 5 |
101 | 14 |
101 | 19 |
102 | 45 |
102 | 58 |
102 | 69 |
102 | 78 |
102 | 89 |
102 | 339 |
Post test data in the form of a datastep, we have asked you this time and time again.
As such no code, retain a variable, add value to this each row, if row is . then set to retained value and then set retained value back to zero.
Retain sum of values and count of items, mean is sum/count
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.