/* This is just the code to read in the data - this code is %include'd by other sas jobs. */ /******************************************************** Note: It appears they don't add the csv for the current year until the end of the year. After it's added, you can add a 'proc import' for that file, and merge it with the master data set... Using data from: http://www.spc.noaa.gov/gis/svrgis/ http://www.spc.noaa.gov/wcm/#data (links to csv data files are at the bottom of that page) This document tells what data is in which column: http://www.spc.noaa.gov/wcm/data/SPC_severe_database_description.pdf var16/var17 = start lat/long var18/var19 = end lat/long *********************************************************/ /* Column Key: 1-(om) Tornado number 2-(yr) Year, 1950-2009 3-(mo) Month, 1-12 4-(dy) Day, 1-31 5-(date) Date in yyyy-mm-dd format 6-(time) Time in HH:MM:SS 7-(tz) Time zone 8-(st) State - Two-letter postal abbreviation (PR=Puerto Rico, VI=Virgin Islands) 9-(stf) State FIPS number (Note some Puerto Rico codes are incorrect.) 10-(stn) State number - number of this tornado, in this state, in this year: May not be sequential in some years. Note: discontinued in 2008. This number can be calculated in a spreadsheet by sorting and after accounting for border crossing tornadoes and 4+ county segments. 11-(f), or (sz), or (mag) F-scale (EF-scale after Jan. 2007): values -9, 0, 1, 2, 3, 4, 5 (-9=unknown). Or, hail size in inches. Or, wind speed in knots (1 knot=1.15 mph). 12-(inj) Injuries - when summing for state totals use sn=1, not sg=1 (see below) 13-(fat) Fatalities - 14-(loss) Estimated property loss information 15-(closs) Estimated crop loss in millions of dollars (started in 2007). Entry of 0 does not mean $0. 16-(slat) Starting latitude in decimal degrees 17-(slon) Staring longitude in decimal degrees 18-(elat) Ending latitude in decimal degrees 19-(elon) Ending longitude in decimal degrees 20-(len) Length in miles 21-(wid) Width in yards 22-(ns), 23-(sn), 24- 25-(f1) 1st County FIPS code 26-(f2) 2nd County FIPS code 27-(f3) 3rd County FIPS code 28-(f4) 4th County FIPS code - Additional counties will be included in sg=-9 records with same om number (see description above). 29-(mt) WIND ONLY Magnitude-type is only used for wind data. EG=estimated gust, MG=measured gust, MS=measured sustained, ES=estimated sustained (started in 2006). */ /* Read in the various data files directly from the web, using 'filename url' */ filename f2018 url 'https://www.spc.noaa.gov/wcm/data/2018_torn_prelim.csv' lrecl=2048; proc import datafile=f2018 out=f2018 dbms=csv replace; getnames=yes; run; /* This prelim data only goes up through Sept 9, 2018. Be sure to get the full data when it is available. */ filename f2017 url 'https://www.spc.noaa.gov/wcm/data/2017_torn.csv' lrecl=2048; proc import datafile=f2017 out=f2017 dbms=csv replace; getnames=yes; run; filename f2016 url 'https://www.spc.noaa.gov/wcm/data/2016_torn.csv' lrecl=2048; proc import datafile=f2016 out=f2016 dbms=csv replace; getnames=yes; run; filename f2015 url 'https://www.spc.noaa.gov/wcm/data/2015_torn.csv' lrecl=2048; proc import datafile=f2015 out=f2015 dbms=csv replace; getnames=yes; run; filename f2014 url 'https://www.spc.noaa.gov/wcm/data/2014_torn.csv' lrecl=2048; proc import datafile=f2014 out=f2014 dbms=csv replace; getnames=yes; run; filename f2013 url 'https://www.spc.noaa.gov/wcm/data/2013_torn.csv' lrecl=2048; proc import datafile=f2013 out=f2013 dbms=csv replace; getnames=yes; run; filename f2012 url 'https://www.spc.noaa.gov/wcm/data/2012_torn.csv' lrecl=2048; proc import datafile=f2012 out=f2012 dbms=csv replace; getnames=yes; run; filename f2011 url 'https://www.spc.noaa.gov/wcm/data/2011_torn.csv' lrecl=2048; proc import datafile=f2011 out=f2011 dbms=csv replace; getnames=yes; run; filename f2010 url 'https://www.spc.noaa.gov/wcm/data/2010_torn.csv' lrecl=2048; proc import datafile=f2010 out=f2010 dbms=csv replace; getnames=yes; run; filename f2009 url 'https://www.spc.noaa.gov/wcm/data/2009_torn.csv' lrecl=2048; proc import datafile=f2009 out=f2009 dbms=csv replace; getnames=yes; run; filename f2008 url 'https://www.spc.noaa.gov/wcm/data/2008_torn.csv' lrecl=2048; proc import datafile=f2008 out=f2008 dbms=csv replace; getnames=yes; run; filename f05_07 url 'https://www.spc.noaa.gov/wcm/data/2005-2007_torn.csv' lrecl=2048; proc import datafile=f05_07 out=f05_07 dbms=csv replace; getnames=yes; run; filename f00_04 url 'https://www.spc.noaa.gov/wcm/data/2000-2004_torn.csv' lrecl=2048; proc import datafile=f00_04 out=f00_04 dbms=csv replace; getnames=yes; run; filename f90_99 url 'https://www.spc.noaa.gov/wcm/data/90-99_torn.csv' lrecl=2048; proc import datafile=f90_99 out=f90_99 dbms=csv replace; getnames=yes; run; filename f80_89 url 'https://www.spc.noaa.gov/wcm/data/80-89_torn.csv' lrecl=2048; proc import datafile=f80_89 out=f80_89 dbms=csv replace; getnames=yes; run; filename f70_79 url 'https://www.spc.noaa.gov/wcm/data/70-79_torn.csv' lrecl=2048; proc import datafile=f70_79 out=f70_79 dbms=csv replace; getnames=yes; run; filename f60_69 url 'https://www.spc.noaa.gov/wcm/data/60-69_torn.csv' lrecl=2048; proc import datafile=f60_69 out=f60_69 dbms=csv replace; getnames=yes; run; filename f50_59 url 'https://www.spc.noaa.gov/wcm/data/50-59_torn.csv' lrecl=2048; proc import datafile=f50_59 out=f50_59 dbms=csv replace; getnames=yes; run; data all_data (rename=(om=tornado_number yr=year stf=state)); set f2018 f2017 f2016 f2015 f2014 f2013 f2012 f2011 f2010 f2009 f2008 f05_07 f00_04 f90_99 f80_89 f70_79 f60_69 f50_59; /* In http://www.spc.noaa.gov/wcm/data/90-99_torn.csv on 5/9/1995, the 2nd coordinate of the line has positive longitude instead of negative ... therefore make it negative. (also, catch & fix any others that might have this problem) */ run; proc sort data=all_data out=all_data; by descending year; run;