Your SAS programs, embedded in web apps and elsewhere

STP GMAP GIF image in Dashboard Indicator

Reply
Occasional Contributor
Posts: 11

STP GMAP GIF image in Dashboard Indicator

==Repost==

I have a stored process with below details and it is showing the output as expected

goptions device=gif;

goptions gsfname=_webout gsfmode=replace;

proc gmap map=USMAP data=usadata all;

  • -

But I want this image in dashboard, so I disabled “STP macro in SAS code” (already steaming and package is enabled and not using %STPBEGIN)

And now throwing

ERROR: Insufficient authorization to access /sas/config94/Lev1/YYYYYY/3225DC00-984F-11E4-A2BB-001E6787D0B2.

note: if the device=png, it will not throw any error, but png will not have drill down facility[interactive/clickable], ie I am able to get a plain US map in dashboard

After doing some research, I added a code as below after goption

%let floc=%sysfunc(pathname(work));

ods html   gpath="&floc"

                file="&floc./test.html"

;

And still it is throwing that error, but it wrote 22KB to work location (&floc)

100 proc gmap map=USMAP data=usadata all;

NOTE: 22252 bytes written to /data1/saswork/SAS_workA38D0004281D_xxxxxx/SAS_workD5DA0004281D_xxxxxx/gmap.gif.

ERROR: Insufficient authorization to access /sas/config94/Lev1/YYYYYY/3225DC00-984F-11E4-A2BB-001E6787D0B2.

Any help will be appreciated

Occasional Contributor
Posts: 11

Re: STP GMAP GIF image in Dashboard Indicator

after including ods listing close; before ODS html

it is not throwing authorization error, but not producing any final output

The SAS program did not produce any output.” And no error in the SAS log.

ie as per SAS BI dashboard 4.4 UG page 57 "Create a Stored Process to Use for Indicator Data" 1.c says

sets the macro variable _ARCHIVE_FULLPATH to the path of the archive file that the stored process generates

I have result from GMAP as

NOTE: 29428 bytes written to /data1/saswork/SAS_workA11F00038935_xxxxxx/SAS_work873800038935_xxxxxx/gmap.gif.

is archive file path  " /data1/saswork/SAS_workA11F00038935_xxxxxx/SAS_work873800038935_xxxxxx/gmap.gif."?

%let _ARCHIVE_FULLPATH=&floc./gmap.gif;  ?

I have also tried few code available in Paper 045-2010, Interactive Dashboards

http://support.sas.com/resources/papers/proceedings10/045-2010.pdf

does the "call package_publish" applicable to streaming gif images too or only for streaming dataset?

Occasional Contributor
Posts: 11

Re: STP GMAP GIF image in Dashboard Indicator

==response from SAS Technical Support===

SAS BI Dashboard supports only static images

and animated GIF files are not supported.  Thus, there is not a way for BI Dashboard to display an interactive, or drillable, map. 

The Information Delivery Portal includes a stored process portlet that might work well for you in this case.

For more information about custom graph indicators, see

http://support.sas.com/documentation/cdl/en/bidbrdug/67143/HTML/default/viewer.htm#n07w7uoobu0eron1p...

Addressing your question about "call package_publish", BI Dashboard consumes data tables from SAS package files.  No other package content can be read from BI Dashboard.

For more information, see

http://support.sas.com/documentation/cdl/en/publishdg/64884/HTML/default/viewer.htm#p0t7sslcpae11kn1...

New Contributor
Posts: 2

Re: STP GMAP GIF image in Dashboard Indicator

Sorry, I had the same issue but was also unable to resolve it. I only needed static images, so I could change it to PNG. I was thinking SAS GIF device has to write the file temporarily to disk before compressing it and streaming it back out and it doesn't have access to write.

 

Another option would be to write the GIF explicitely to a location that you do have write access to and then use a streaming stored process called from the image tag to display it. That is what I do in one of my applications that does use a GIF with an image map:

 

Streaming Stored Process code:

 

%global dir file type;

filename streamin "&setup_dataroot./&dir./&file." recfm=n;

data _null_;
length type $8;

if "&type." eq "" then do;
type = "%upcase(%scan(&file.,-1,.))";
end;
else type = "%upcase(&type.)";

if fileexist("&setup_dataroot./&dir./&file.") then do;
select (type);
when ("PDF") do;
rc = stpsrv_header('Content-type','application/pdf');
end;
when ("RTF") do;
rc = stpsrv_header('Content-type','application/msword');
rc = stpsrv_header("Content-disposition", "attachment; filename=&file.");
end;
when ("XLS","XLSX","XML") do;
rc = stpsrv_header('Content-type','application/vnd.ms-excel');
rc = stpsrv_header("Content-disposition", "attachment; filename=&file.");
end;
when ("CSV") do;
rc = stpsrv_header("Content-type", "text/x-comma-separated-values");
rc = stpsrv_header("Content-disposition", "attachment; filename=&file.");
end;
when ("GIF") do;
rc = stpsrv_header("Content-type", "image/gif");
end;
when ("PNG") do;
rc = stpsrv_header("Content-type", "image/png");
end;
when ("HTML") do;
end;
otherwise do;
rc = stpsrv_header('Content-disposition',"attachment; filename=&file.");
end;
end;
rc = stpsrv_header("Pragma", "nocache");

** No idea why fcopy doesnt work. It corrupts the files **;

/* rc = fcopy("streamin","_webout");*/
/* msg = sysmsg();*/
/* put msg;*/

** This seems shockingly inefficient, reading the file byte by byte **;

length filein 8 fileid 8;
filein = fopen('streamin','I',1,'B');
fileid = fopen('_webout','O',1,'B');
rec = '20'x;
do while(fread(filein) eq 0);
rc = fget(filein,rec,1);
rc = fput(fileid,rec);
rc = fwrite(fileid);
end;
rc = fclose(filein);
rc = fclose(fileid);
end;
else do;
put "ERROR: File &setup_dataroot./&dir./&file. does not exist.";
end;
run;

filename streamin;

 

 

Then in the generated HTML:

 

 

  <AREA SHAPE="POLY" COORDS="675,88,675,87,674,87,673,87,673,88,673,89,674,89,675,89" ALT="265"">
  <AREA SHAPE="POLY" COORDS="680,88,680,87,679,87,678,87,678,88,678,89,679,89,680,89" ALT="265"">
  <AREA SHAPE="POLY" COORDS="685,99,685,98,684,98,683,98,683,99,683,100,684,100,685,100" ALT="262"">
  <AREA SHAPE="POLY" COORDS="690,158,690,157,689,157,689,156,688,157,688,158,688,159,689,159,690,159" ALT="245"">
  <AREA SHAPE="POLY" COORDS="695,143,695,142,694,142,693,142,693,143,693,144,693,145,694,145,695,145,695,144" ALT="249"">
  <AREA SHAPE="POLY" COORDS="700,149,700,148,699,148,698,148,698,149,698,150,699,150,700,150" ALT="248"">
  <AREA SHAPE="POLY" COORDS="705,156,705,155,704,154,703,155,703,156,703,157,704,157,705,157" ALT="246"">
  <AREA SHAPE="POLY" COORDS="710,107,710,106,710,105,709,105,708,105,708,106,708,107,708,108,709,108,710,108" ALT="260"">
  <AREA SHAPE="POLY" COORDS="715,123,715,122,714,122,713,122,713,123,713,124,714,124,715,124" ALT="255"">
  <AREA SHAPE="POLY" COORDS="720,113,720,112,719,112,718,112,718,113,718,114,719,114,720,114" ALT="258"">
  <AREA SHAPE="POLY" COORDS="725,131,725,130,724,130,723,130,723,131,723,132,724,132,725,132" ALT="253"">
  <AREA SHAPE="POLY" COORDS="730,112,730,111,729,111,728,111,728,112,728,113,729,113,730,113" ALT="258"">
</MAP>
<TR><TH align="centre"><IMG src="/SASStoredProcess/do?_program=/IAG_BI/POC_STP/stream&dir=IAL/Images&file=IAL_000_AL_VVC_av_pdnewpaid.gif&time=1792943157.14393" width=750 height=495 USEMAP="#imap1" border = 0></TH></TR>
Ask a Question
Discussion stats
  • 3 replies
  • 800 views
  • 3 likes
  • 2 in conversation