LET YSTAT = WINDOW MEAN Y
LET YSTAT = CROSS TABULATE MEAN Y X
The distinction is in how the groups are formed. For the LET ... = CROSS TABULATE command, the groups are formed based on the distinct values of the group-id variable (X in the above example). For the LET .. = WINDOW command, groups are formed from contiguous rows of the response variable. The LET NSIZE command is used to specify the size of each group.
This can in fact be used for any supported statistic (enter HELP STATISTIC for a list of supported statistics).
where <y1> ... <yk> is a list of one to three response variables (depending on what <stat> is);
<stat> is one of the supported statistics (HELP STATISTICS for a list);
<yout> is a variable where the computed values are stored;
and where the <SUBSET/EXCEPT/FOR qualification> is optional.
LET Y2 = WINDOW MEDIAN Y
LET Y2 = WINDOW SD Y SUBSET Y > 0
skip 25 read gear.dat y let nsize = 20 let ymean = window mean y set write decimals 4 print ymeanThe following output is generated
--------------- YMEAN --------------- 0.9986 0.9968 0.9954 1.0010 0.9966