(View the complete code for this example.)
This example shows how to retrieve World Weather Online data for three locations (London, Paris, and Dubai), starting today and ending today (num_of_days=1), with a 24-hour frequency. The output is shown in Output 53.4.1.
options validvarname=any;
title 'Retrieve Weather Data for Three Cities';
libname mylib "/sasusr/rain/doc/";
libname rain saserain "%sysget(RAIN_DATA)"
apikey='XXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
query='London,United Kingdom;Paris,France;Dubai,United Arab Emirates'
format=XML
outXml=tricity
automap=replace
mapref=MyMap
xmlmap="%sysget(RAIN_DATA)tricity.map"
num_of_days=1
tp=24
;
data mylib.threecit;
set rain.tricity;
run;
proc contents data=mylib.threecit; run;
proc print data=mylib.threecit; run;
Output 53.4.1: Local Weather for London, Paris, and Dubai
| Retrieve Weather Data for Three Cities |
| Obs | date | AreaName | Country | Region | oc | latitude | longitude | maxtempC | maxtempF | mintempC | mintempF | totalSnow_cm | sunHour | uvIndex | time | tempC | tempF | windspeedMiles | windspeedKmph | winddirDegree | winddir16Point | weatherCode | weatherDesc | precipMM | humidity | visibility | pressure | cloudcover | HeatIndexC | HeatIndexF | DewPointC | DewPointF | WindChillC | WindChillF | WindGustMiles | WindGustKmph | FeelsLikeC | FeelsLikeF | chanceofrain | chanceofremdry | chanceofwindy | chanceofovercast | chanceofsunshine | chanceoffrost | chanceofhightemp | chanceoffog | chanceofsnow | chanceofthunder |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 2018-05-11 | London | United Kingdom | City of London, Greater London | 1 | 51.5170 | -0.1060 | 18 | 64 | 12 | 54 | 0 | 0 | 6 | 24 | 18 | 64 | 9 | 14 | 161 | SSE | 299 | Moderate rain at times | 0.70000 | 57 | 18 | 1016 | 53 | 14 | 58 | 6 | 42 | 14 | 57 | 11 | 17 | 14 | 57 | 87 | 0 | 0 | 87 | 0 | 0 | 0 | 0 | 0 | 0 |
| 2 | 2018-05-11 | Paris | France | Ile-de-France | 2 | 48.8670 | 2.3330 | 22 | 71 | 15 | 58 | 0 | 0 | 6 | 24 | 22 | 71 | 6 | 10 | 119 | ESE | 116 | Partly cloudy | 0.00000 | 52 | 19 | 1017 | 13 | 16 | 61 | 6 | 42 | 16 | 60 | 7 | 12 | 16 | 60 | 0 | 87 | 0 | 33 | 88 | 0 | 0 | 0 | 0 | 0 |
| 3 | 2018-05-12 | Dubai | United Arab Emirates | Dubai | 3 | 25.2520 | 55.2800 | 38 | 101 | 29 | 84 | 0 | 0 | 12 | 24 | 38 | 101 | 8 | 14 | 178 | S | 116 | Partly cloudy | 0.00000 | 33 | 20 | 1005 | 0 | 34 | 92 | 15 | 59 | 33 | 91 | 15 | 25 | 34 | 92 | 0 | 80 | 0 | 42 | 79 | 0 | 96 | 0 | 0 | 0 |