BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
DavidPhillips2
Rhodochrosite | Level 12
How can I include a semi-colon in the variable created in a data step?  I found a post that talked about superq, but it seems to not work for me in this case.
data _null_;
  length result1 $3000;
result1 = catx(' ',  result1, 'Hello world', 40.);
  call symputx('defineAnalysis1',      result1, 'g'); 
run;
/*This shows Hello world*/
/*how to make it show Hello world;*/
%put &defineAnalysis1;

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

You just put the semi-colon where you want it, and then you will need to %QUOTE the results

 

data _null_;
  length result1 $3000;
  result1 = catx(' ',  result1, 'Hello world;',40);
  call symputx('defineAnalysis1',      result1, 'g'); 
run;
/*This shows Hello world*/
/*how to make it show Hello world;*/
%put %quote(&defineAnalysis1);
--
Paige Miller

View solution in original post

3 REPLIES 3
Astounding
PROC Star
The easiest way: include the semicolon when replacing RESULT1. The 3rd parameter in CATX would become:

'Hello world:'

Do you have some conditions that would make this a bad idea?
PaigeMiller
Diamond | Level 26

You just put the semi-colon where you want it, and then you will need to %QUOTE the results

 

data _null_;
  length result1 $3000;
  result1 = catx(' ',  result1, 'Hello world;',40);
  call symputx('defineAnalysis1',      result1, 'g'); 
run;
/*This shows Hello world*/
/*how to make it show Hello world;*/
%put %quote(&defineAnalysis1);
--
Paige Miller
DavidPhillips2
Rhodochrosite | Level 12

Thanks, I was googling escape characters for a while.

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