Data visualization with SAS programming

export a sas map to .html

Reply
Occasional Contributor tvh
Occasional Contributor
Posts: 5

export a sas map to .html

Hi everyone,

I am working with SAS/Map (Function Proc Gmap...) and have a problems: When exporting the result (map) to a .html file. The .html file can only opened at the computer which already installed SAS (or some SAS' components). 


So, I would like to seek your advice/help: How to export the result (map) to a .html file which can open without installing any SAS component.

Thank you.

SAS Employee
Posts: 980

export a sas map to .html

The answer depends on what "goptions device=" you are using.  For example...

If you're using device=png, then you will need to make sure the computer viewing the html file can also get to the png file (the html file points to the png file with an html 'img' tag).  I usually write the html and png file to the same directory, and use relative pathnames (relative to the current directory) for everything.

If you're using device=activex, then each computer viewing the html will need the SAS/Graph activex controll installed to view the output (there are several ways to do this, and you can even set up the graph to prompt the user to install the activex control if they don't already have it installed).

If you're using device=java, then you'll need to have the SAS java stuff in a location they can get to, and point your 'codebase' to that location.

Occasional Contributor tvh
Occasional Contributor
Posts: 5

export a sas map to .html

Thank you very much for your kind help.

Btw, There is a problem, EG seems to generate automated HTML outputs in some restricted areas:

For example:

data X;
    x =1;
    run;

proc print;
    run;
ods html text= 'Hello';

The above code run with an error message:

NOTE: Writing HTML Body file: sashtml25.htm

ERROR: Insufficient authorization to access /software/sas/AnalyticsServer/Lev1/SASMain/sashtml25.htm.

WARNING: No body file. HTML output will not be created.

I don't know how to fix the error.

Occasional Contributor tvh
Occasional Contributor
Posts: 5

export a sas map to .html

 

Below is the same error about "Insufficient authorization to access...". I am trying to fix.

-----------------

ods listing close;


ods html  gpath="c:\SAS_MAP" file="c:\SAS_MAP\SAS.html";

/* Set the SAS/Graph options */
goptions reset=all hpos=40 xpixels=600 ypixels=300;

/* Set the SAS/Graph device driver */
goptions device=png;

* select an empty pattern (v=e) and a title;
pattern v=e;
title ' US MAP Data set';

* use a SAS-supplied map data set (US) as both the map and response data sets;
proc gmap
map=maps.us
data=maps.us (obs=1)
all;
id state;
choro state / nolegend;
run;
quit;

/* Reset all graphics options */
goptions reset=all;

/* End ODS output */
ods html close;
ods listing;

NOTE: Writing HTML Body file: c:\SAS_MAP\SAS.html

ERROR: Insufficient authorization to access /software/sas/AnalyticsServer/Lev1/SASMain/c:\SAS_MAP\SAS.html.

WARNING: No body file. HTML output will not be created.

SAS Employee
Posts: 980

export a sas map to .html

Ahh - so many wayt to run SAS jobs!

Sorry, but I don't know the answer to that one.

Perhaps it would be a good one to post to the Enterprise Guide section:

http://communities.sas.com/community/sas_enterprise_guide

SAS Super FREQ
Posts: 8,820

Re: export a sas map to .html

Hi:

  It looks from this piece of the insufficient authorization error message

/software/sas/AnalyticsServer/Lev1/SASMain/c:\SAS_MAP\SAS.html

like you are trying to run in EG and you have a Lev1/SASMain directory, which implies to me that you are also running this under the context of the BI Platform -- which has some explicitly coded server location for your output (that is NOT on your C drive). When you specify GPATH=, you are saying to put the image file on your C drive. But with just FILE=, ODS thinks that down under the Lev1/SASMain directory, it will find the other directories that make up the rest of your FILE= option. This is because it looks like the BI plaform issues an explicit PATH= option and you need to get that out of your way. FILE= and GPATH= by themselves won't do that for you. Generally, the FILE= location is appended to the PATH= location...which in your case, isn't what you want.

So, you might try this in your code:

ods _all_ close;

ods html path='c:\SAS_MAP' (url=none)  /* send the table .HTML to c:\SAS_MAP */

        gpath="c:\SAS_MAP" (url=none)  /* send images to c:\SAS_MAP */

        file="mySASmap.html" style=egdefault; /* name the file a specific name */

 

*** your code;

 

ods html close;

Explicitly setting both a PATH= and a GPATH= (and with URL=NONE suboption) SHOULD explicitly tell EG and ODS to send ALL of your results back to your C drive. The ODS _ALL_ CLOSE; statement will close ANY open destinations that EG, under the BI Platform, might have open (such as SASReport, HTML, RTF and PDF). The reason you want to close all of these BEFORE you start your code is that you do not want any EG statements or EG/ODS statements added around your hard-coded ODS HTML statements. If that doesn't work, you might want to work with Tech Support and/or your EG administrator.

  One last warning: if you are trying to do this as a stored process, then the ODS HTML statements are not appropriate at all.

cynthia

Occasional Contributor tvh
Occasional Contributor
Posts: 5

Re: export a sas map to .html

Thanks Cynthia.

It didn't work. I will post the problem to EG section.

SAS Super FREQ
Posts: 8,820

export a sas map to .html

Hi:

  I'd almost recommend opening a track with Tech Support at this point.

cynthia

SAS Employee
Posts: 25

Re: export a sas map to .html

The problem is you're attempting to write to your PC's C:\  drive from SAS running on Unix.  The Unix SAS process does not recognize the path from C:\ as a local file system, so appends it as a relative path to the current working directory, which for the WorkspaceServer is /software/sas/AnalyticsServer/Lev1/SASMain.  The result is the odd path you are seeing.

You will need to specify a valid Unix path for the GPATH and FILE.  If you need/want to write to your PC, you will need to make use of Samba or some other means to enable the Windows path to be mounted as a Unix file system so that the Unix process has access.

New Contributor HE
New Contributor
Posts: 4

Re: export a sas map to .html

Hi,

try this , it works fine for me

ods graphics on;

ods html file='/ORGN/../seg1.html' gpath="/ORGN../Graph";

proc univariate data=rest ; 

var a;

histogram a;

run ;

ods html close;

Hadi

Ask a Question
Discussion stats
  • 9 replies
  • 1470 views
  • 8 likes
  • 5 in conversation