BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ANLYNG
Pyrite | Level 9

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;

1 ACCEPTED SOLUTION

Accepted Solutions
gamotte
Rhodochrosite | Level 12

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

11 REPLIES 11
Shmuel
Garnet | Level 18

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.

ANLYNG
Pyrite | Level 9

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.

gamotte
Rhodochrosite | Level 12
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.
ANLYNG
Pyrite | Level 9

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?

gamotte
Rhodochrosite | Level 12
Try
%nrstr(&)boss=&boss.%nrstr(&)unit=&unit.
ANLYNG
Pyrite | Level 9

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

gamotte
Rhodochrosite | Level 12

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>");

ANLYNG
Pyrite | Level 9

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.

gamotte
Rhodochrosite | Level 12

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.

 

 

ANLYNG
Pyrite | Level 9

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.

gamotte
Rhodochrosite | Level 12

%26boss=%trim(&boss.)

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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