BookmarkSubscribeRSS Feed
rakshit_shah
Calcite | Level 5


Hello all,

     I have made one link format and applied it to one variable. Now i want to pass this variable in macro.

The value of variable is as follows:

 

The value of Path_name is :

<a href='javascript:goToObject("Director?_directive=GRC_FinancialImpact&handle=10314|")'> 10314</a>

I want to pass it in macro variable. I tried %str and %nrstr but still it is giving error. Any solution??

Regards,

Rakshit

2 REPLIES 2
DanRalyea
Calcite | Level 5

I believe %SUPERQ will mask the & and " allowing you to pass the string through without attempting to resolve the & reference. To use %Superquote the path will be stored in a macro variable then referenced.

data _null_;

call symput('mv1','Smith&Jones');

call symput('mv2','%macro abc;');

run; %let testmv1=%superq(mv1);

%let testmv2=%superq(mv2);

%put Macro variable TESTMV1 is &testmv1;

%put Macro variable TESTMV2 is &testmv2;

When this program executes, these lines are written to the SAS log:

Macro variable TESTMV1 is Smith&Jones

Macro variable TESTMV2 is %macro abc;

Ksharp
Super User

In your path_name, there are several unmatched single or double quote , you should put % before it to avoid error message.

%let path=%nrstr(<a href=%'javascript:goToObject(%"Director?_directive=GRC_FinancialImpact&handle=10314|%")%'> 10314</a>) ;

%put &path;

Ksharp

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2 replies
  • 797 views
  • 0 likes
  • 3 in conversation