*
* Read original data with year month and day fields
*
open data djia.txt
data(format=free,org=columns) 1 18940 year month day logret logrange close low high
*
* Switch to quarterly calendar covering the period needed.
*
cal(q) 1928:4
all 1999:4
set iqrange 1928:4 1999:4 = 0.0
*
* Use STATS with FRACT and SMPL to compute 25th and 75th quantiles.
*
do time=1928:4,1999:4
stats(fract,noprint,smpl=year==%year(time).and.(fix(month)+2)/3==%period(time)) logret 1 18940
compute iqrange(time)=%fract75-%fract25
end do timeset year = %year(t)
set month = %month(t)
set day = %day(t)Return to Data: Reading, Writing, Transforming
Users browsing this forum: No registered users and 1 guest