Hi,
I've never done mapping in SAS before (or any other application for that matter). I've had a peak at Robert Allison's website, and it has lots of good examples, but they're a little too complex for me to just stick my data into it and customise.
We have a lot of data, which has the latitude/longitude. These values don't match what we see in MAPS.AUSTRAL. They're off by a factor on 100, having said that, it obviously doesn't have every single point in Australia on that table.
So, what I'd like to do is with my small subset of data identify each point on a map, and with a variable, eg income, I would want the point to be coloured a certain way.
eg,
Latitude: -27.465608
Longitude: 153.010336
Income: $50,000,000
and
Latitude: -28.005627
Longitude: 153.367188
Income: $20,000,000
Let's say anything more than $25,000,000 get a red dot, otherwise it gets a green dot.
How would I use the above with the MAPS.AUSTRAL ?
Thanks.
edit:
I should say I'm using SAS 9.2 TS Level 2M0 on Windows XP
edit:
I have attempted to do this based on the following link
http://robslink.com/SAS/democd28/impact_info.htm
^^
here's the log, the output gives me nothing on the html file and a picture of Australia with no dots on it. What am I doing wrong? Or am I attempting to approach this the wrong way?
[pre]
NOTE: This SAS session is using a registry in WORK. All changes will be lost at
the end of this session.
1425 filename odsout '.';
1426
1427
1428 data stadiums;
1429 name = 'SC Stadium';
1430 Lat = -27.465608;
1431 Long = 153.010336;
1432 Income = 50000000;
1433 output;
1434
1435 name = 'GC Stadium';
1436 Lat = -28.005627;
1437 Long = 153.367188;
1438 Income = 20000000;
1439 output;
1440 run;
NOTE: The data set WORK.STADIUMS has 2 observations and 4 variables.
NOTE: DATA statement used (Total process time):
real time 0.04 seconds
cpu time 0.03 seconds
1441
1442
1443 data stadiums_plot;
1444 set stadiums;
1445
1446 x=atan(1)/45 * long;
1447 y=atan(1)/45 * lat;
1448
1449
1450
1451 anno_flag=2;
1452
1453 if Income >= 25000000 then
1454 do;
1455 color='cxa50f15';
1456 zoom=9;
1457 end;
1458 else
1459 do;
1460 color='cxde2d26';
1461 zoom=10;
1462 end;
1463
1464 * Draw a pie, to check centering of your letter 'o' *;
1465 function='pie'; rotate=360; size=.5; position='5';
1466 style='psolid'; output;
1467 style='pempty'; color='black'; output;
1468
1469 run;
NOTE: There were 2 observations read from the data set WORK.STADIUMS.
NOTE: The data set WORK.STADIUMS_PLOT has 4 observations and 14 variables.
NOTE: DATA statement used (Total process time):
real time 0.23 seconds
cpu time 0.03 seconds
1470
1471
1472 proc sql;
1473 create table world as
1474 select
1475 -1*long as x,
1476 lat as y,
1477 segment,
1478 cont as continent,
1479 id as country
1480 from maps.world
1481 where (density<=1) and (id ^= 143);
NOTE: Table WORK.WORLD created, with 14070 rows and 5 columns.
1482 /* where id = 160*/
1483 ;
1484 create table mydata as
1485 select
1486 unique continent, country, 1 as color
1487 from world
1488 ;
NOTE: Table WORK.MYDATA created, with 260 rows and 3 columns.
1489 quit;
NOTE: PROCEDURE SQL used (Total process time):
real time 0.76 seconds
cpu time 0.07 seconds
1490
1491
1492 data combined;
1493 set world
1494 stadiums_plot;
1495 run;
NOTE: There were 14070 observations read from the data set WORK.WORLD.
NOTE: There were 4 observations read from the data set WORK.STADIUMS_PLOT.
NOTE: The data set WORK.COMBINED has 14074 observations and 17 variables.
NOTE: DATA statement used (Total process time):
real time 0.28 seconds
cpu time 0.04 seconds
1496
1497
1498 proc gproject data = combined out=combined dupok eastlong project=gall;
1499 id continent country;
1500 run;
NOTE: The GALL projection is experimental.
NOTE: POLELONG = -9.92333E-13.
NOTE: There were 14074 observations read from the data set WORK.COMBINED.
NOTE: The data set WORK.COMBINED has 14074 observations and 17 variables.
NOTE: PROCEDURE GPROJECT used (Total process time):
real time 0.56 seconds
cpu time 0.03 seconds
1501
1502
1503
1504 data world impact_sites;
1505 set combined;
1506
1507 length href_string $200.;
1508
1509 href_string = 'http://maps.google.com/?ie=UTF8&ll='
1510 || trim(left(lat))
1511 || ','
1512 || trim(left(long))
1513 || '&spn=0.074899,0.102654&t=h&z='
1514 || trim(left(zoom))
1515 || '&om=1';
1516
1517 length html $1024.;
1518
1519 if style='pempty' then
1520 html = 'title='
1521 || quote( trim(left(id))
1522 || '0d'x
1523 || 'Diameter: '
1524 || trim(left(name))
1525 || ' km'
1526 || '0d'x
1527 || 'Age: '
1528 || trim(left(income))
1529 || ' Ma'
1530 || ' ' )
1531 || ' '
1532 || 'href='
1533 || quote(href_string);
1534
1535 if anno_flag=2 then output impact_sites;
1536 else output world;
1537 run;
NOTE: Numeric values have been converted to character
values at the places given by: (Line):(Column).
1510:29 1512:29 1514:29 1521:33 1528:35
NOTE: Variable id is uninitialized.
NOTE: There were 14074 observations read from the data set WORK.COMBINED.
NOTE: The data set WORK.WORLD has 14070 observations and 20 variables.
NOTE: The data set WORK.IMPACT_SITES has 4 observations and 20 variables.
NOTE: DATA statement used (Total process time):
real time 1.51 seconds
cpu time 0.26 seconds
1538
1539
1540
1541 GOPTIONS DEVICE=png;
1542 goptions xpixels=1000 ypixels=650;
1543 goptions cback=white;
1544 goptions border;
1545
1546 ODS LISTING CLOSE;
1547 ODS HTML path=odsout body="stadium.htm"
1548 (title="SAS/Stadium Map") style=minimal;
NOTE: Writing HTML Body file: stadium.htm
1549
1550 pattern1 color=lig;
1551
1552 goptions htitle=5pct ftitle="arial/bold" htext=2.75pct ftext="arial"
1552! ctext=gray;
1553
1554 title1 justify=left " Stadiums label";
1555 footnote1 j=c "click dots for detailed map";
1556
1557
1558 proc gmap data=mydata map=world anno=impact_sites;
1559 id continent country;
1560 choro color /
1561 coutline=graybb
1562 nolegend discrete
1563 des="" name="stadium";
1564 quit;
NOTE: PROCEDURE GMAP used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
1565
1566
1567
1568
1569 proc sql ;
1570 create table table_data as
1571 select unique name, href_string, lat, long, income
1572 from impact_sites
1573 order by income
1574 ;
NOTE: Table WORK.TABLE_DATA created, with 2 rows and 5 columns.
1575 quit;
NOTE: PROCEDURE SQL used (Total process time):
real time 0.25 seconds
cpu time 0.03 seconds
1576
1577 data table_data;
1578 set table_data;
1579
1580 length link $300 href $300;
1581 label link='Impact Site';
1582 href = 'href="' || trim(left(href_string)) || '"';
1583 link = '<a ' || trim(href) || ' target="body">' || htmlencode(trim(name))
1583! || '</a>';
1584 run;
NOTE: There were 2 observations read from the data set WORK.TABLE_DATA.
NOTE: The data set WORK.TABLE_DATA has 2 observations and 7 variables.
NOTE: DATA statement used (Total process time):
real time 0.23 seconds
cpu time 0.01 seconds
1585 options nocenter;
1586 title1 justify=left "Meteorite Impact Craters";
1587 footnote1 j=l link="http://www.solarviews.com/eng/crater.htm"
1588 "Based on 10sep2007 data from
http://www.solarviews.com/eng/crater.htm ";
1589 proc report data=table_data;
1590 column link lat long income name;
1591 define income / center;
1592 define long / right;
1593 define lat / right;
1594 run;
NOTE: This SAS session is using a registry in WORK. All changes will be lost at
the end of this session.
NOTE: This SAS session is using a registry in WORK. All changes will be lost at
the end of this session.
NOTE: There were 2 observations read from the data set WORK.TABLE_DATA.
NOTE: PROCEDURE REPORT used (Total process time):
real time 6.46 seconds
cpu time 0.34 seconds
1595
1596 ODS HTML CLOSE;
1597 ODS LISTING;
NOTE: This SAS session is using a registry in WORK. All changes will be lost at
the end of this session.
NOTE: This SAS session is using a registry in WORK. All changes will be lost at
the end of this session.
NOTE: This SAS session is using a registry in WORK. All changes will be lost at
the end of this session.
[/pre]