Hi!
I have three variables, that need to be joined to one variable and output to new line separate by backslash. Sorry...so weird to explain!!
I tried:
data final1;
length class $300.;
set final;
class=sys||'/'||'~n/'||hiterm||'/'||'~n/'|| lowterm;
run;
proc print data=final1;
run;
I need to one variable 'class' with concatenated values of sys, hiterm,lowterm on unique line when '/' encountered:
CLASS
sys/
hiterm/
lowterm
or sample data output
CLASS
Investigation/
Metabolism/
Hyperglycemia
Hi:
You only show one statement. You don't show the rest of your code. Are you using PROC PRINT, PROC REPORT??
You don't show any ODS statement -- I guess that you are using ODS because ~n is the old ESCAPECHAR way of inserting a new line into a text string to show line breaks in ODS HTML, RTF or PDF output. But not all destinations use ESCAPECHAR, so it would be useful to see more code.
Here's an ODS HTML example using the new ESCAPECHAR syntax and showing the output:
Cynthia
Hi:
You only show one statement. You don't show the rest of your code. Are you using PROC PRINT, PROC REPORT??
You don't show any ODS statement -- I guess that you are using ODS because ~n is the old ESCAPECHAR way of inserting a new line into a text string to show line breaks in ODS HTML, RTF or PDF output. But not all destinations use ESCAPECHAR, so it would be useful to see more code.
Here's an ODS HTML example using the new ESCAPECHAR syntax and showing the output:
Cynthia
Use CATX instead to concatenate the variables together, it's cleaner and easier to follow.
class=sys||'/'||'0D0A'x||hiterm||'/'||'0D0A'x|| lowterm;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.