Your SAS programs, embedded in web apps and elsewhere

STP ODS HTML PROC SGRENDER & _webout as landing page

Reply
Occasional Contributor
Posts: 6

STP ODS HTML PROC SGRENDER & _webout as landing page

[ Edited ]

Greetings!

 

I've encountered the following interesting phenomena:

I'm generating graphs (9.04.01M4P110916) with SGRENDER and using ODS to create html drill down functionality. Everything is working fine, the images and the htmls are properly generated with the desired content, except that the first graph I generate will have the following html img src tag:

 

<IMG class=c style="HEIGHT: 1080px; WIDTH: 1920px" border=0 alt="Die Prozedur SGRender" src="/SASStoredProcess/do?_sessionid=D5D2F237-F64E-425C-A1CB-DD538B2ABDCB&amp;_program=replay&amp;_entry=APSWORK.TCAT0057.curent_year.png" useMap=#curent_year>

Instead of following the structure of the other generated htmls' img src tags:

 

<IMG class=c style="HEIGHT: 1080px; WIDTH: 1920px" border=0 alt="Die Prozedur SGRender" src="\\*****\Users\***\Documents\My SAS Files\9.4\last_2_months.png" useMap=#last_2_months>

 

The outp macro variable is:

 

%let outp = \\******\Users\%substr(%sysfunc(dequote(&_METAUSER)),1,7)\Documents\My SAS Files\9.4;

 

The code that I'm using to generate the htmls and the images is as follows:

 

%macro main;
	/** 
	START

	displaying all available arbstnrs with overall completeness percentages, links are pointing to individual arbstnrs displaying incuding yearly aggregates

	**/
	proc template;
		define statgraph basechart;
			begingraph / designwidth=1280 designheight=720 subpixel=on;
				layout overlay / cycleattrs = true
					yaxisopts=(griddisplay=on gridattrs=(color=lightgray pattern=dot));
					barchart category=arbsttext response=main_completeness_pct /
						name="completeness"
						group=arbstnr_dwh
						groupdisplay=cluster
						barwidth=0.5
						clusterwidth=0.5
						dataskin=crisp
						url = to_url
						tip = (group) barlabel = true
					;
				endlayout;
			endgraph;
		end;
	run;

%macro genmain;
	ods graphics / reset imagemap=on imagename="main"
		antialiasmax=2000 tipmax=2000 drilltarget="_self" push show;
	ods html path="&outp." file="main.html";
	%let intable=main_display_all;

	proc sgrender data=&intable. template=basechart;
		title &intable.;
		footnote 'main page';
	run;

	ods html close;
	ods graphics / reset imagemap=off;
%mend;

%genmain;

/** 
END

displaying all available arbstnrs with overall completeness percentages, links are pointing to individual arbstnrs displaying incuding yearly aggregates

**/
%mend;

 

And:

 

%macro mainy;
	/** 
	START

	displaying specific arbstnr with yearly completeness percentages, links are pointing to individual arbstnrs displaying monthly aggregates
	**/
	proc template;
		define statgraph basechart;
			begingraph / designwidth=1280 designheight=720 subpixel=on;
				layout overlay / cycleattrs = true
					yaxisopts=(griddisplay=on gridattrs=(color=lightgray pattern=dot));
					barchart category=neu_year_dwh response=yearly_completeness_pct / stat = mean
						name="completeness"
						group=arbsttext
						groupdisplay=cluster
						barwidth=0.5
						clusterwidth=0.5
						dataskin=crisp
						url = to_url
						tip = (group) barlabel = true;
				endlayout;
			endgraph;
		end;
	run;

%macro genmain_yearly(arbstnr=);
	ods graphics / reset imagemap=on imagename="main_&arbstnr." 
		antialiasmax=2000 tipmax=2000 drilltarget="_self" push show;
	ods html path="&outp." file="main_&arbstnr..html";
	%let intable=result_&ye.;

	proc sgrender data=&intable. template=basechart;
		title &intable._&arbstnr;
		where arbstnr_dwh = "&arbstnr";
		footnote link="&outp..\main.html" 'Back';
	run;

	ods html close;
	ods graphics / reset imagemap=off;
%mend;

%let intable = main_display_all;
filename mainy catalog "work.main_arbst.graphs.source";

data _null_;
	set &intable.;
	file mainy recfm=v lrecl=1024;
	put '%genmain_yearly(arbstnr=' @;
	put arbstnr_dwh @;
	put ');';
run;

%include mainy;
filename mainy clear;

/** 
END

displaying specific arbstnr with yearly completeness percentages, links are pointing to individual arbstnrs displaying monthly aggregates

**/
%mend;

 

To create the landing page I use the following code:

%let link = \\******\Users\%substr(%sysfunc(dequote(&_METAUSER)),1,7)\Documents\My SAS Files\9.4;
%let text=Fertig.;
ods trace off;
ods _all_ close;
ods html body=_webout path=&_tmpcat
	(url=&_replay);
title;
footnote;
ods html text="&text";

data landing;
	length Ergebnisse $200;
	Ergebnisse = "<a href=""&link"">hier</a>";
run;

proc print data= landing noobs;
	title "Ergebnisse";
	footnote link = 'https://*****/SASStoredProcess/do?_action=form,properties,execute,nobanner,newwindow&_program=*****' "Back";
quit;

ods html close;

 

The STP is saved in metadata as follows:

STP - Kopie.png

What should I change to avoid the incorrect html img src creation?

Thanks in advance!

EDIT - the html img src tags were having the _html in the image names, they have been removed

Super User
Posts: 10,889

Re: STP ODS HTML PROC SGRENDER & _webout as landing page

You reference a macro variable "&outp." used in the output path but do not show where or when in your code that macro variable is set. So there may be something associated with that.

 

 

Occasional Contributor
Posts: 6

Re: STP ODS HTML PROC SGRENDER & _webout as landing page

Hi


ballardw wrote:

You reference a macro variable "&outp." used in the output path but do not show where or when in your code that macro variable is set. So there may be something associated with that.

 

 


 

 See 3rd code snippet for outp definition.


Ask a Question
Discussion stats
  • 2 replies
  • 171 views
  • 0 likes
  • 2 in conversation