BookmarkSubscribeRSS Feed
sat_lr
Calcite | Level 5

Hi All,

I am looking for coordinates for the mentioned address.

The data set has a address column and it contains district names and state names. It is of one column perhaps doesn't have post code.

How to get coordinates as my customer looks for geo map to locate the production units.

Thanks in advance.

regards

19 REPLIES 19
MichelleHomes
Meteorite | Level 14

I'm not sure what address you are referring to and what country you are hoping to geocode.

You might find this SAS Global Forum 2013 paper a good reference to understand geocoding and how to do it using PROC GEOCODE - http://support.sas.com/rnd/papers/sasgf13/Geocode2013.pdf

//Contact me to learn how Metacoda software can help keep your SAS platform secure - https://www.metacoda.com
PeterWijers
Lapis Lazuli | Level 10

I Use a sas script that requests the longitude/latitude off an address string from google maps.

This way I get all my long/latitudes and use these in SAS VA.

If  you want to solve it this way, I can sent you the related SAS code. It works well for me this way.

Requesting the Centre country long/lat also helps with drilling down. (Also for geo area)

Greetings.

sat_lr
Calcite | Level 5

Yes pls thats would be grt. Thanks Peter.

Pls inbox me.

This thing is that I have already started using the data set and I have produed visualizations, dashboards and explorations. Now I have got a new requirement from the customer to include geo maps.


kindly suggest me how I can run the codes. should I have to create a new SAS data set? will it append as a geo category automatically which is existing in-memory in SAS VA data source?

PeterWijers
Lapis Lazuli | Level 10

Hi sat_Ir,

I will sent the full script to your mail account.

Here for all the other interested users.

The main function in SAS is as follows, but still needs some scripting to get ir right.

%MARCRO Url_get_comp(key, street, zipc, city, country);

%LET Url_address="https://maps.googleapis.com/maps/api/geocode/xml?address=&street,+&zipc,+&city,+&country*sensor=fals...";

%LET Url_address=%sysfunc(TRANSLATE(&URL_address,'&','*'));

%PUT &Url_address; FILENAME www url &Url_address;

I create a table that contains the non matched addresses and call on the macro by record.

The received log/lat are stored in the address table and sent to the VA server.

This address table in imported into VA via a data querry and ready for use.

Now Change the role of the address field name to Geography and assign the log/lat under custom.

This field will now ackt as a geo location field.

Greetings and succes.

adriana_dominguez
Calcite | Level 5

Hi, Peter! How are you?

I have recently been playing with the ggmap library in R to do precisely the discussed here: give long/lat for a dataset where I have specific addresses. I just recently discovered that one can do this with SAS. Could you also share your macro code with me? That would be extremely helpful!

Greetings from Mexico

PeterWijers
Lapis Lazuli | Level 10

Hi Adriana.

of course you can get the full macro code.

Please give me your e-mail and I will sent it to you.

Greetings from Holland.

adriana_dominguez
Calcite | Level 5

Thank you!

PeterWijers
Lapis Lazuli | Level 10

Adriane,

the full scruipt has been sent to your e-mail.

Good luck while implementing it.

Greetings.

Jeove74
Obsidian | Level 7

Hi Peter,

Can I receive the full code example as well 🙂

Kind regards,

Jesper Bæk Overgaard

PeterWijers
Lapis Lazuli | Level 10


Hello Jesper,

here is the code I sadly forgot to append in the past.  (Anna, sorry for that)

greetings and good luck with it.

AnnaBrown
Community Manager

Thanks a bunch, Peter.

Jesper, welcome to the community! FYI, I deleted your email address on this thread for security reasons. I hope you have everything you need with Peter's attached code.

Best,

Anna

sat_lr
Calcite | Level 5

Hi Peter,

grt info. thanks very much for the reply. I have created the geo map using your script. Thanks.

satlr

PeterWijers
Lapis Lazuli | Level 10

Hi satir,

verry good to hear it works out for you.

Thats what its all about here.

Greetings

bhagia
Calcite | Level 5

Hi Peter,

could you please sent that code to me?

Thanks

bhagia

Regards
Bhagya

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 19 replies
  • 6587 views
  • 15 likes
  • 9 in conversation