I have table (with only numric columns) in SAS Enterprise Guide like below:
YEAR | COL1 | COL2
-------|-------|------
2021 | 20 | 10
2022 | 25 | 30
2023 | 5 | 1
And I need to sum values in each column except column "YEAR" to have total value per column. So I need something like below:
YEAR | COL1 | COL2
-------|-------|------
2021 | 20 | 10
2022 | 25 | 30
2023 | 5 | 1
TOTAL | 50 | 41
How can I do that in SAS Enterprise Guide / PROC SQL ?
If you need only summed values you can make a new table:
If you want it in original table (I have no idea why you would like that) you can do it by firstly creating a new table for totals, and adding it to your old table. But you won't be able to have 'TOTAL' in your YEAR column as it should be num type. So I just left YEAR as missing in that row. That second approach is like this: