Proc Means is one of the procedures that are enhanced for in-database processing so may be translating the logic into SQL won't give you anything else than more work and higher complexity code. http://support.sas.com/documentation/cdl/en/proc/67327/HTML/default/viewer.htm#p0rbwzwi5gyyxwn1irfgkjgprt1p.htm Haven't tried it but it's worth a shot: You could define below options before running your Proc Means code. Proc Means being an in-database enhanced procedures SAS will try to convert the proc syntax into SQL code and send it to the database. The options below will show you the SQL code generated in the SAS log. This will show you if SAS could translate the Proc Means code fully into SQL and if you still want to go for a SQL replacement then the code generated would also be a very good starting point for you (just copy/paste it). OPTIONS SASTRACE=',,,d' SASTRACELOC=SASLOG NOSTSUFFIX;
... View more