Resources

Spectral Analysis of Sunspot Activity

/*--------------------------------------------------------------

                    SAS Sample Library

        Name: speex01.sas
 Description: Example program from SAS/ETS User's Guide,
              The SPECTRA Procedure
       Title: Spectral Analysis of Sunspot Activity
     Product: SAS/ETS Software
        Keys: spectral and cross-spectral
              analysis of time series
        PROC: SPECTRA
       Notes:

--------------------------------------------------------------*/

title "Wolfer's Sunspot Data";
data sunspot;
   input year wolfer @@;
datalines;
1749  809 1750  834 1751  477 1752  478 1753  307 1754  122 1755   96
1756  102 1757  324 1758  476 1759  540 1760  629 1761  859 1762  612
1763  451 1764  364 1765  209 1766  114 1767  378 1768  698 1769 1061
1770 1008 1771  816 1772  665 1773  348 1774  306 1775   70 1776  198
1777  925 1778 1544 1779 1259 1780  848 1781  681 1782  385 1783  228
1784  102 1785  241 1786  829 1787 1320 1788 1309 1789 1181 1790  899
1791  666 1792  600 1793  469 1794  410 1795  213 1796  160 1797   64
1798   41 1799   68 1800  145 1801  340 1802  450 1803  431 1804  475
1805  422 1806  281 1807  101 1808   81 1809   25 1810    0 1811   14
1812   50 1813  122 1814  139 1815  354 1816  458 1817  411 1818  304
1819  239 1820  157 1821   66 1822   40 1823   18 1824   85 1825  166
1826  363 1827  497 1828  625 1829  670 1830  710 1831  478 1832  275
1833   85 1834  132 1835  569 1836 1215 1837 1383 1838 1032 1839  858
1840  632 1841  368 1842  242 1843  107 1844  150 1845  401 1846  615
1847  985 1848 1243 1849  959 1850  665 1851  645 1852  542 1853  390
1854  206 1855   67 1856   43 1857  228 1858  548 1859  938 1860  957
1861  772 1862  591 1863  440 1864  470 1865  305 1866  163 1867   73
1868  373 1869  739 1870 1391 1871 1112 1872 1017 1873  663 1874  447
1875  171 1876  113 1877  123 1878   34 1879   60 1880  323 1881  543
1882  597 1883  637 1884  635 1885  522 1886  254 1887  131 1888   68
1889   63 1890   71 1891  356 1892  730 1893  849 1894  780 1895  640
1896  418 1897  262 1898  267 1899  121 1900   95 1901   27 1902   50
1903  244 1904  420 1905  635 1906  538 1907  620 1908  485 1909  439
1910  186 1911   57 1912   36 1913   14 1914   96 1915  474 1916  571
1917 1039 1918  806 1919  636 1920  376 1921  261 1922  142 1923   58
1924  167
;

proc sgplot data=sunspot;
   series x=year y=wolfer / markers markerattrs=(symbol=circlefilled);
   xaxis values=(1740 to 1930 by 10);
   yaxis values=(0 to 1600 by 200);
run;

proc spectra data=sunspot out=b p s adjmean whitetest;
   var wolfer;
   weights 1 2 3 4 3 2 1;
run;

proc print data=b(obs=12);
run;

proc sgplot data=b;
   series x=freq y=p_01 / markers markerattrs=(symbol=circlefilled);
run;

proc sgplot data=b;
   series x=period y=p_01 / markers markerattrs=(symbol=circlefilled);
run;

proc sgplot data=b;
   series x=freq y=s_01 / markers markerattrs=(symbol=circlefilled);
run;

proc sgplot data=b;
   series x=period y=s_01 / markers markerattrs=(symbol=circlefilled);
run;

proc sgplot data=b;
   where period < 50;
   series x=period y=s_01 / markers markerattrs=(symbol=circlefilled);
   refline 11 / axis=x;
run;
title;