'SAS proc means equivalent in Redshift

I want to convert a SAS code into redshift code. We have proc means procedure in SaS,

proc means data=table0 noprint, nway missing;
id a ,b
class  x
var qty
output out=table1 sum = ;

Example: Input enter image description here

Required Output: enter image description here

I wanted an equivalent code in redshift. The usual group by will not work here.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source