BookmarkSubscribeRSS Feed
Pavan4
Calcite | Level 5

I need  help for the  below 

 

data new ;

x ='http://google.com';

run ;

 

I would need the below output for x value

 

 X =   <A href=" http://google.com'  " target="_blank">Click Here</A>.

 

can any body help me on this 

 

1 REPLY 1
ballardw
Super User

@Pavan4 wrote:

I need  help for the  below 

 

data new ;

x ='http://google.com';

run ;

 

I would need the below output for x value

 

 X =   <A href=" http://google.com'  " target="_blank">Click Here</A>.

 

can any body help me on this 

 


First thing is before assigning any value to the variable x is to define length long enough to hold the longest expected line. Otherwise the initial assignment sets the length of the variable to 17 characters and anything inserted before that would loose characters at the end.

 

One way:

data new ;
   length x $ 200;
   x ='http://google.com';
   x = catt('<A href="',x,' "target="_blank">Click Here</A>');
   put x;
run ;

this assumes that the single ' you showed at the end of google.com was accidentally included in a copy and paste. If that is not the case show only the text of the desired result not something that looks like an assignment statement that won't work.

 

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
  • 1 reply
  • 627 views
  • 0 likes
  • 2 in conversation