(View the complete code for this example.)
This example shows how to use one World Weather Online location query to retrieve weather data for Dubai, starting today and ending tomorrow (num_of_days=2), with a 24-hour frequency. The output is shown in Output 53.3.1.
options validvarname=any;
title 'Retrieve Weather Data for Dubai';
libname mylib "/sasusr/rain/doc/";
libname myplace saserain "%sysget(RAIN_DATA)"
apikey='XXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
query='Dubai,United Arab Emirates'
format=XML
outXml=dubhot
automap=replace
mapref=MyMap
xmlmap="%sysget(RAIN_DATA)dubhot.map"
num_of_days=2
tp=24
;
data mylib.hotdub;
set myplace.dubhot;
run;
proc contents data=mylib.hotdub; run;
proc print data=mylib.hotdub; run;
Output 53.3.1: Local Weather for Dubai
| Retrieve Weather Data for Dubai |
| 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-12 | Dubai | United Arab Emirates | Dubai | 1 | 25.2520 | 55.2800 | 38 | 101 | 29 | 84 | 0 | 0 | 12 | 24 | 38 | 101 | 8 | 14 | 178 | S | 116 | Partly cloudy | 0 | 33 | 20 | 1005 | 0 | 34 | 92 | 15 | 59 | 33 | 91 | 15 | 25 | 34 | 92 | 0 | 80 | 0 | 42 | 79 | 0 | 96 | 0 | 0 | 0 |
| 2 | 2018-05-13 | Dubai | United Arab Emirates | Dubai | 1 | 25.2520 | 55.2800 | 40 | 103 | 30 | 86 | 0 | 0 | 12 | 24 | 40 | 103 | 17 | 28 | 224 | SW | 116 | Partly cloudy | 0 | 35 | 20 | 1003 | 4 | 36 | 97 | 16 | 62 | 35 | 95 | 31 | 49 | 36 | 97 | 0 | 93 | 2 | 43 | 75 | 0 | 92 | 0 | 0 | 0 |