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 2025: Register Today!

 

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 720 views
  • 0 likes
  • 3 in conversation