Hi @Demarchi83
SAS Proc SQL which I think is based on SQL 1992 standards does not support SQL windowing analytical functions.
You alternatives are :
- Data Step with the DOW loop --- Fully Customizable
- Proc Report --- Fully Customizable
- Proc Freq --- Limited Customizable
- Proc summary/means --- Limited Customizable
Hope this helps,
Ahmed
@AhmedAl_Attar wrote:SAS Proc SQL which I think is based on SQL 1992 standards does not support SQL windowing analytical functions.
PROC SQL :
SAS Viya 4 SQL Procedure User’s Guide
PROC FEDSQL :
The FedSQL language (PROC FEDSQL) is the SAS implementation of the ANSI SQL:1999 core standard.
BR, Koen
If you want to calculate a running sum just use a SUM STATEMENT.
There is no need to jumps throw hoops to try an impose sequential data processing on SQL's normal set based processing.
data PARETO ;
set CLSD_01;
where PERIODO = 202311;
acumulado + MRG_SR;
keep CD_CLI MRG_SR acumulado ;
run;
If you want to generate separate accumulations per group then use BY group processing.
data PARETO ;
set CLSD_01;
by PERIODO CD_CLI ;
if first.PERIODO then acumulado=0;
acumulado + MRG_SR;
keep PERIODO CD_CLI MRG_SR acumulado ;
run;
Home > Learn SAS > New Users >
culmulative sum by group using Proc SQL
https://communities.sas.com/t5/New-SAS-User/culmulative-sum-by-group-using-Proc-SQL/td-p/517593
Home > Programming > Programming >
Cumulative total using proc sql
https://communities.sas.com/t5/SAS-Programming/Cumulative-total-using-proc-sql/td-p/614451
Koen
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.