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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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