BookmarkSubscribeRSS Feed
hhh123
Fluorite | Level 6

Hi,

I have this sas dataset that contains the list of id`s. When the VA user clicks on any of the id`s then a dynamic URL corresponding to that id is created using stored process and a PROC report runs that creates an HTML page with the Text having hyperlink to the newly created URL. So basically what i am doing is 2 way step i.e. first creating dynamic URL and then creating seperate HTML page to open it. Is there any way in which it can be done in single step. That is user click on the id, dynamic URL is created and it pops up on the new screen?

Please find attached screenshot as well.

 

This is first screen with different id`sThis is first screen with different id`sOn clicking on any id a stored process runs and new HTML page opens in new tabOn clicking on any id a stored process runs and new HTML page opens in new tabClicking on the hyperlink in the HTML page the actual reports corresponding to that id opens up in new tab.Clicking on the hyperlink in the HTML page the actual reports corresponding to that id opens up in new tab.

%global wantreg _odsdest _odsstyle ; 
%macro setopt; 
%let _odsdest=HTML;
%let _odsstyle=sasweb;
options nodate nonumber missing='0' orientation=landscape;
%mend setopt; 

%macro Repot(wktid=); 
%let url=/*dynamic url taking wktid as input*/
	data test;
  		VA_REPORT= "Click here for VA Report";
  		url = "&url";
	run;
	proc report nowd;
		col url VA_REPORT;
		define url /noprint;
		define VA_REPORT /display;
		compute VA_REPORT;
    		call define(_col_, "url", url);
		endcomp;
	run;
%mend Repot; 

*ProcessBody;
%setopt;
%stpbegin;

%Repot(wktid=&wktid);

%stpend;

 So basically i wan`t to avoid the HTML page that shows up with the actual URL for VA report corresponding to a particular id, instead directly opening the VA reports for that id.

1 REPLY 1
jltz83
Obsidian | Level 7

I think an External Link and a bit of JavaScript in a Stored Process may be the simplest solution for this. I'm not an expert in working with Stored Processes or JavaScript, but I was recently able to put something together that allows me to open a new browser tab to a url determined by an attribute of a GeoMap Object. 

 

I used the External Link to pass the selected attribute as a parameter to a stored process that contains script that opens the new browser tab. There is probably a more efficient way of doing this, but I used the location.replace function because the process was opening two new tabs when called. I believe one was the location of the Process itself and the second was the url that I wanted. 

 

For now, I just have two options hard-coded in an if-then statement in the script. Eventually I want to have this set up to reference a lookup table that inlude many more url's. 

 

Hope this helps.

 

pic1.PNG

 

%global district;

data _null_;
file _webout;
	if "&district" in ('COLUMBIA 93 (010093)') then
		put "
		<script>
		function myFunction() {
			location.replace('https://www.cpsk12.org/');
		}
		</script>
		
		<body onload='myFunction()'>
		</body>
		";
	else if 
		"&district" in ('JEFFERSON CITY (026006)') then
		put "
		<script>
		function myFunction() {
			location.replace('https://www.jcschools.us/');
		}
		</script>
		
		<body onload='myFunction()'>
		</body>
		";
	else 
		put "
		<script>
		function myFunction() {
			location.replace('https://dese.mo.gov/');
		}
		</script>
		
		<body onload='myFunction()'>
		</body>
		";

run;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 1 reply
  • 2317 views
  • 1 like
  • 2 in conversation