Code:
* Example generated by -dataex-. To install: ssc install dataex clear input double AKST_datetime float(Ta_NOAA Ta_mean30_p Ta_mean60_p) 1.7304192e+12 -2.6 . . 1.7304195e+12 -2.6 . . 1.7304198e+12 -2.5 . . 1.7304201e+12 -2.5 . . 1.7304204e+12 -2.2 . . 1.7304207e+12 -2.1 . . 1.730421e+12 -2 -2.416667 . 1.7304213e+12 -2 -2.3166666 . 1.7304216e+12 -1.9 -2.2166667 . 1.7304219e+12 -1.8 -2.1166666 . 1.7304222e+12 -1.7 -2 . 1.7304225e+12 -1.7 -1.9166666 . 1.7304228e+12 -1.7 -1.85 -2.1333334 1.7304231e+12 -1.6 -1.8 -2.0583334 1.7304234e+12 -1.6 -1.7333333 -1.975 1.7304237e+12 -1.5 -1.6833333 -1.9 1.730424e+12 -1.5 -1.6333333 -1.8166667 1.7304243e+12 -1.5 -1.6 -1.7583333 1.7304246e+12 -1.4 -1.5666667 -1.7083334 1.7304249e+12 -1.4 -1.5166667 -1.6583333 1.7304252e+12 -1.3 -1.4833333 -1.6083333 1.7304255e+12 -1.3 -1.4333333 -1.5583333 1.7304258e+12 -1.3 -1.4 -1.5166667 1.7304261e+12 -1.3 -1.3666667 -1.4833333 1.7304264e+12 -1.2 -1.3333334 -1.45 1.7304267e+12 -1.2 -1.3 -1.4083333 1.730427e+12 -1.2 -1.2666667 -1.375 1.7304273e+12 -1.2 -1.25 -1.3416667 1.7304276e+12 -1.2 -1.2333333 -1.3166667 1.7304279e+12 -1.3 -1.2166667 -1.2916666 1.7304282e+12 -1.3 -1.2166667 -1.275 1.7304285e+12 -1.4 -1.2333333 -1.2666667 1.7304288e+12 -1.4 -1.2666667 -1.2666667 1.7304291e+12 -1.5 -1.3 -1.275 1.7304294e+12 -1.4 -1.35 -1.2916666 1.7304297e+12 -1.5 -1.3833333 -1.3 1.73043e+12 -1.4 -1.4166666 -1.3166667 end format %tc AKST_datetime
gen L5=Ta_NOAA[_n-1]
gen L10=Ta_NOAA[_n-2]
gen L15=Ta_NOAA[_n-3]
gen L20=Ta_NOAA[_n-4]
gen L25=Ta_NOAA[_n-5]
gen L30=Ta_NOAA[_n-6]
gen Ta_mean30_pp = (L5 + L10 + L15 + L20 + L25 + L30)/6
Thanks!
Dan
0 Response to Generate a moving window average
Post a Comment