DATA Step, Macro, Functions and more

link two stored processes by parameters

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 75
Accepted Solution

link two stored processes by parameters

[ Edited ]

I have one stored proces where Iet the user select boss and unit and then run a proc report.

On the proc report I have different links/URL in a data field where Iink to another Stored process. But how do I get the parameters transfered from the first stored process? and to be used in the URL???? I have tried to define it(marked with red) but it takes the text and not the macro value. Help ...

 

Thanks in advance.

 

 

***some code;


proc report data=ud1 ls=132 ps=58 nocenter missing nowd split=" "                                                                                                                                                                      
                                                                style(report)=[just=right outputwidth=100% font_face=arial font_size=2 font_style=roman ]                                                                                                                                                          
                                                                style(column)=[just=left /*outputwidth=100%*/ font_face=arial font_size=2 font_style=roman BACKGROUND=WHITE]                                                                                                                                           
                                                                style(summary)=[font_face=arial font_size=2 font_style=roman ]                                                                                                                                                                                     
                                                                style(header)=[foreground=#003366 font_face=arial font_size=2 font_style=roman ];                                                                                                                                                                  
                                                                ;
COLUMN   unitname boss kpi KPI_beskrivelse resultat KPI_Kommentarer opdat; 

define unitname/DISPLAY width=10 spacing=1 left "unitname" style(column)={just=left};
define boss/DISPLAY width=10 spacing=1 left "boss" style(column)={just=left};                                                                                                                                                                         
define kpi/DISPLAY width=10 spacing=1 left "KPI" style(column)={just=left};
define KPI_bem/DISPLAY width=20 spacing=1 left "Bem" style(column)={just=left};
define result/DISPLAY width=20 spacing=1 left "result" style(column)={just=left};
define KPI_K/DISPLAY width=10 spacing=1 left "KPI K" style(column)={just=left};
define opdat/COMPUTED  width=300 spacing=1 left "Opdatere" style(column)={just=left};

RBREAK BEFORE / SUMMARIZE SKIP OL UL ;

compute opdat/char length=300;
if kpi='YYYY'
then opdat=
'<A HREF="http://infbisas4wp.int.addom.dk/SASStoredProcess/do?_action=form,properties,execute,nobanner,newwind...&boss=boss&unit=unit">Opdatere</a>';
if kpi='XXXX'
then opdat=
'<A HREF="http://infbisas4wp.int.addom.dk/SASStoredProcess/do?_action=form,properties,execute,nobanner,newwind... statistik&boss=boss&unit=unit">Opdatere</a>';

endcomp;
run;


Accepted Solutions
Solution
‎12-19-2016 10:01 AM
Regular Contributor
Posts: 240

Re: link two stored processes by parameters

It should work. Check that the resulting string is not truncated which would explain why it doesn't appear as a link.

Increase the length if necessary.

 

 

View solution in original post


All Replies
Trusted Advisor
Posts: 1,586

Re: link two stored processes by parameters

Your code:

'<A HREF="http://infbisas4wp.int.addom.dk/SASStoredProcess/do?_action=form,properties,execute,nobanner,newwind...&boss=boss&unit=unit">Opdatere</a>';

is enclosed with single quotes, therefore macro variables are not resolved.

try next code:

 

"<A HREF=""http://infbisas4wp.int.addom.dk/SASStoredProcess/do?_action=form,properties,execute,nobanner,newwind...&boss=boss&unit=unit"">Opdatere</a>";

 

I have changed yhe single quotes to double and the inner quotes were doubled.

Frequent Contributor
Posts: 75

Re: link two stored processes by parameters

it says that there is an invalid value for 

 

 action: form,properties,execute,nobanner,newwindow/Data fra forretningen/Data til DWH/Enhedskontrakter/Enhedskontrakter_opdatere_STP1ny=/Data fra forretningen/Data til DWH/Enhedskontrakter/Enhedskontrakter_opdatereSTP2.

Regular Contributor
Posts: 240

Re: link two stored processes by parameters

In addition to Shmuel's answer, if i understand your problem correctly, the first stored process creates two macrovariables &boss and &unit that you want to add as arguments in the URL. So you have to distinguish, in your url, between the '&' as an argument separator and the '&' for macrovariables resolution. Within your double-quoted URL, you can then add your arguments this way :
%str(&)boss=&boss.%str(&)unit=&unit.
Frequent Contributor
Posts: 75

Re: link two stored processes by parameters

it moves in the right way. however the macro reference is still resolved in both the macro referencen &unit and its value. I need only the value to be resolved. Is there a hint?

Regular Contributor
Posts: 240

Re: link two stored processes by parameters

Try
%nrstr(&)boss=&boss.%nrstr(&)unit=&unit.
Frequent Contributor
Posts: 75

Re: link two stored processes by parameters

it stills resolves both (reference and value)...

Regular Contributor
Posts: 240

Re: link two stored processes by parameters

[ Edited ]

OK, I just tried on a small example and it behaves as you say.

Another option is to use url encoding and the urldecode function.

 

opdat=urldecode("<A HREF....%26boss=&boss.%26unit=&unit."">Opdatere</a>");

Frequent Contributor
Posts: 75

Re: link two stored processes by parameters

Your solution is close to be correct...the macro reference and value is correct but ..one little thing is that the url is not hidden into the text opdatere? is that possible?thanks in advance.

Solution
‎12-19-2016 10:01 AM
Regular Contributor
Posts: 240

Re: link two stored processes by parameters

It should work. Check that the resulting string is not truncated which would explain why it doesn't appear as a link.

Increase the length if necessary.

 

 

Frequent Contributor
Posts: 75

Re: link two stored processes by parameters

it works....but i could be nice if the macro values could be trimmed? as there is extra space before the value....thanks for your input - it made the solutuon in the end.

Regular Contributor
Posts: 240

Re: link two stored processes by parameters

%26boss=%trim(&boss.)

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 11 replies
  • 324 views
  • 1 like
  • 3 in conversation