BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mathias
Quartz | Level 8

Hi,

How come the RANGE attribute has no effect whit MIDPOINTS=OLD ?

PROC GMAP DATA=&WorkingTable._INCIDENCE

MAP=Common.BE_ARROND(where=(&mapFilter))

ALL density=1 ;

ID NIS2;

choro casesper100k /

/* */

MIDPOINTS=OLD

uniform

levels=5

range

LEGEND=LEGEND1

&AnnotateStatement

;

&ByStatement;

RUN;QUIT;

Thanks,

Regards,


Capture.PNG
1 ACCEPTED SOLUTION

Accepted Solutions
GraphGuy
Meteorite | Level 14

Aha! - The "stored process" hint might be the key here!

If your stored process server is on Windows, then it silently defaults to device=actximg unless you override it ... and device=activeximg/activex does not support the 'range' option (as mentioned in the gmap choro doc).

Here's how you can code a stored process to use device=png instead of taking the default. Note that in a stored process you cannot simply put "goptions device=png;" in the code.

%let _GOPT_DEVICE=png;

%let _ODSOPTIONS=gtitle gfootnote style=sasweb;

%stpbegin;

View solution in original post

10 REPLIES 10
GraphGuy
Meteorite | Level 14

In the general case, the range option does work with midpoints=old, such as ...

proc gmap data=maps.us map=maps.us;

id state;

choro state / levels=5 midpoints=old range;

run;

Perhaps something else is coming into play in your map? ... Version of SAS, format of your choro variable, your legend statement, your data (numeric/char?), device you're using (png, gif, javaimg, actximg), etc.  We would probably need the rest of your sas job, and your data, to experiment and figure this one out.

foo.png

mathias
Quartz | Level 8

Happy to know it can be solved.

- Version of SAS : SAS base 9.3

- I dont use a format I think, the variable is rounded after the first decimal so i would say the format of  CasesPers100k is *.1

- legend statement i don't see what could cause this :

LEGEND1

ACROSS=1

POSITION=(BOTTOM LEFT INSIDE)

LABEL=("[Reported cases / 1E5 inhabitants]" position=(right bottom))

MODE=PROTECT

;

- data is numeric

- device is PNG I believe (it's the output of a stored process, so titles are HTML and the image is png)

Its difficult to assemble all data and code because it's a stored process accessing macros within marcos. i'll try to gather everything as clean as possible and post it in a few minutes.

GraphGuy
Meteorite | Level 14

Aha! - The "stored process" hint might be the key here!

If your stored process server is on Windows, then it silently defaults to device=actximg unless you override it ... and device=activeximg/activex does not support the 'range' option (as mentioned in the gmap choro doc).

Here's how you can code a stored process to use device=png instead of taking the default. Note that in a stored process you cannot simply put "goptions device=png;" in the code.

%let _GOPT_DEVICE=png;

%let _ODSOPTIONS=gtitle gfootnote style=sasweb;

%stpbegin;

mathias
Quartz | Level 8

here it is

- the map = be_arrond.sas7bdat

- the data = postcodes_test.sas7bdat

- the code = arrond_map_test.sas (=macro + execution)

replace "Common.BE_ARROND" on line 232 with the map

replace "WORK._0UPLOADTESTEPISTAT_PC" on line 334 with the data

it should produce output.PNG

Thanks again for helping me


output.PNG
GraphGuy
Meteorite | Level 14

I don't see a call to the stpbegin macro in your code.

How are you setting up the stored process? - through EG or something?

If so, you'll need to figure out how to override the actximg default, and use device=png via that interface.

Note that just because the image is a png file, doesn't mean that device=png is being used ... device=actximg produces a png file also (but it doesn't use SAS' device=png driver).

mathias
Quartz | Level 8

I think you found it.

the macro is called by a very big stored process which writes this before the %stpbegin:

options mstored sasmstore=common fmtsearch=(common) minoperator;

option noxwait xsync;

ODS path (PREPEND) WORK.TEMPLAT(WRITE);

ODS path (PREPEND) COMMON.TEMPLAT(READ);

ODS path show;

%let _ODSDEST = html ;

%let _ODSSTYLE = wivisp1 ;

%let _ODSSTYLESHEET = ;

%STPBEGIN ;

I just added %let _GOPT_DEVICE=png;

before the %stpbegin and It made me ranges Smiley Happy

Capture2.PNG

Great !

How can I round the values ? do I need to round up my choro variable ?

Also, now when I right-clic on the image and ask "Save as..." it creates an .htm file. Is this normal ?

GraphGuy
Meteorite | Level 14

You can add a 'format' statement to apply a format to your choro variable, and it will generally use that in the numbers shown in the range.  Here is an example where I use a format statement to add 2 decimal places (in your case, you'll probably want to use a format such as comma10.0 to show 0 decimal places)...

proc gmap data=maps.us map=maps.us;

format state comma10.2;

id state;

choro state / levels=5 midpoints=old range;

run;

SAS/Graph device=png output created with ods html generally has both html and one (or more) png files. The html would have mouse-over text and drilldowns (if you used the html= option to specify them), and in your case the titles & footnotes (since the stored process defaults to nogtitle and nogfootnote). I would recommend using the options I recommended (above) to have the stored process use gtitles and gfootnotes, so that both your graph and the titles/footnotes are in the png file, and then all you have to worry about saving is just the png file.

format_map.png

mathias
Quartz | Level 8

Format works perfectly, thanks.

And

%let _ODSOPTIONS=gtitle gfootnote;

create a real png as you said.

However I cannot force titles and footnotes in the png as it would burden users to remove it every time.

You see another solution than screenshots to download the png ?

GraphGuy
Meteorite | Level 14

Typically, when viewing SAS/Graph device=png (or even device=actximg) output in a web browser, I can right-click on the graph and save-as the png file.

Perhaps the "thing" that's displaying the stored process is adding another layer of something? What browser are you using (IE, Chrome, Firefox, etc). And how are you displaying the stored process? (directly via stored process webapp url? via something in the BI portal? other?)

mathias
Quartz | Level 8

Now it's saving in png... chrome & firefox

strange..

Perfect job Smiley Happy

Thanks a lot for your help !

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 10 replies
  • 2888 views
  • 6 likes
  • 2 in conversation