I want to compute a cumulative max grouped by another column.

Say I have this data:

```
data have;
input grp $ number;
datalines;
a 3
b 4
a 5
b 2
a 1
b 8
;

```

My desired output would be:

```
data want;
input grp $ cummax;
a 3
b 4
a 5
b 4
a 5
b 8
;

```

My real case will involve several grouping columns + filters, and ideally this cumulative max would be computed on several columns at the same time.

My main concern is computational efficiency as I'll be running this on tables of ten to hundred millions of rows. Proc SQL or native SAS are both welcome.

Rows might be shuffled if necessary.

**System Info**

```
proc product_status;run;

```

> 
> 
> ```
> For Base SAS Software ...
>    Custom version information: 9.3_M2
>    Image version information: 9.03.01M2P080112
> For SAS/STAT ...
>    Custom version information: 12.1
>    Image version information: 9.03.01M0P081512
> For SAS/GRAPH ...
>    Custom version information: 9.3_M2
> For SAS/CONNECT ...
>    Custom version information: 9.3_M2
> For SAS OLAP Server ...
>    Custom version information: 9.3_M1
> For SAS Enterprise Miner ...
>    Custom version information: 12.1
>    Image version information: 9.03.01M0P081512
> For SAS Integration Technologies ...
>    Custom version information: 9.3_M2
> For SAS/ACCESS Interface to Oracle ...
>    Custom version information: 9.3_M1
> For SAS/ACCESS Interface to PC Files ...
>    Custom version information: 9.3_M2
> 
> ```
> 
> 

```
    proc setinit;run;

```

> 
> 
> ```
> Product expiration dates:
> ---Base SAS Software                                                                                    31JUL2018  
> ---SAS/STAT                                                                                             31JUL2018  
> ---SAS/GRAPH                                                                                            31JUL2018  
> ---SAS/CONNECT                                                                                          31JUL2018  
> ---SAS OLAP Server                                                                                      31JUL2018  
> ---SAS Enterprise Miner                                                                                 31JUL2018  
> ---MDDB Server common products                                                                          31JUL2018  
> ---SAS Integration Technologies                                                                         31JUL2018  
> ---SAS Enterprise Miner Server                                                                          31JUL2018  
> ---SAS Enterprise Miner Client                                                                          31JUL2018  
> ---Unused OLAP Slot                                                                                     31JUL2018  
> ---SAS Enterprise Guide                                                                                 31JUL2018  
> ---SAS/ACCESS Interface to Oracle                                                                       31JUL2018  
> ---SAS/ACCESS Interface to PC Files                                                                     31JUL2018  
> ---SAS Metadata Bridges for Informatica                                                                 31JUL2018  
> ---SAS Metadata Bridges for Microsoft SQL Server                                                        31JUL2018  
> ---SAS Metadata Bridge for Oracle                                                                       31JUL2018  
> ---SAS Workspace Server for Local Access                                                                31JUL2018  
> ---SAS Workspace Server for Enterprise Access                                                           31JUL2018  
> ---SAS Table Server                                                                                     31JUL2018  
> ---DataFlux Trans DB Driver                                                                             31JUL2018  
> ---SAS Framework Data Server                                                                            31JUL2018  
> ---SAS Add-in for Microsoft Excel                                                                       31JUL2018  
> ---SAS Add-in for Microsoft Outlook                                                                     31JUL2018  
> ---SAS Add-in for Microsoft PowerPoint                                                                  31JUL2018  
> ---SAS Add-in for Microsoft Word                                                                        31JUL2018
> 
> ```
> 
>