= SPSS Scratch Variables = A '''scratch variable''' is a temporary variable that is not initialized between cases. As a program iterates over each row of data, scratch variables retain their value. <> ---- == Declaration == Scratch variables are declared with a hash (`#`) prefix. Try: {{{ compute #TotalSales = sum(Sales, #TotalSales). }}} ---- == Usage == Scratch variables are firstly useful as temporary variables. They are automatically deleted in the next [[SPSS/Execute|execution]]. Scratch variables can also be used to aggregate data. {{{ compute #TotalSales = sum(Sales, #TotalSales). compute Total_Sales = #TotalSales. }}} ---- CategoryRicottone