create cursor saled (theyear i, themonth i,units i) > >for i=3 to 12 >ii=i+18 >iii=ii*ii >insert into saled values (2004,i,iii) >endfor > >for i=1 to 12 >ii=i+45 >iii=ii*ii >insert into saled values (2005,i,iii) >endfor > > >for i=1 to 12 >ii=i+72 >iii=ii*ii >insert into saled values (2006,i,iii) >endfor > > >select saled >index on alltrim(str(theyear))+alltrim(str(themonth))tag ymd index on padl(theyear, 4, '0') + padl(themonth, 2, '0') tag ymd >set order to tag ymd in saled > >select distinct themonth from saled into cursor yearsm readwrite nofilter >alter table yearsm add column sl2004 i >alter table yearsm add column sl2005 i >alter table yearsm add column sl2006 i > > >select yearsm >scan > cthemonth=alltrim(str(yearsm.themonth)) cthemonth = padl(yearsm.themonth, 2, '0') > cyearm='2004'+cthemonth > select saled > if seek (cyearm,'saled','ymd')=.f. > loop > endif > replace yearsm.sl2004 with saled .units in yearsm >endscan > > > >select yearsm >scan > cthemonth=alltrim(str(yearsm.themonth)) cthemonth = padl(yearsm.themonth, 2, '0') > cyearm='2005'+cthemonth > select saled > if seek (cyearm,'saled','ymd')=.f. > loop > endif > replace yearsm.sl2005 with saled .units in yearsm >endscan > > >select yearsm >scan > cthemonth=alltrim(str(yearsm.themonth)) cthemonth = padl(yearsm.themonth, 2, '0') > cyearm='2006'+cthemonth > select saled > if seek (cyearm,'saled','ymd')=.f. > loop > endif > replace yearsm.sl2006 with saled .units in yearsm >endscan > > > >select yearsm >brow