The query builder use SQL so in general, you cannot access the value of a previous rows as SQL does not in general terms respect a concept of data row order. Now with said, might your data have some column that can be used as a unique identiifier, and might the summing be based on the order of that "unique" column... say somethig like date? Given this assumption, you could use a self-join with an inequality and group summary. Take for example the SASHELP.AIR table... date and total number of international miles traveled. Join the AIR table with itself, and modify the join operator in the TABLES window so that T1.DATE >= T2.DATE. In the SELECT DATA window, add t1.DATE, t1.AIR, and sum(T2.AIR). Edit the groups to include only T1.DATE. PROC SQL; CREATE TABLE WORK.QUERY_FOR_AIR AS SELECT t1.DATE, t2.AIR, /* SUM_of_AIR */ (SUM (t2.AIR)) AS SUM_of_AIR FROM SASHELP.AIR t1 INNER JOIN SASHELP.AIR t2 ON (t1.DATE >= t2.DATE) GROUP BY t1.DATE; ;
... View more