BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Zatere
Quartz | Level 8

Hello,

 

I am wondering if you could help me please.

 

I want to store a short text into a variable in different lines.

 

Please see below:

 

data want;
 text_in_many_lines = 
  "Hello, 
  This is a text in many lines.
Thanks.";
run;

If I do so, I am able to store it but not in many lines as shown above.

 

Is there any way to do it?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Do you want this to appear in separate lines in a report? If so, explain further.

 

There really is no concept of "many lines" in a SAS data set, you could insert a carriage break character into the string, but that's really useless unless you want to put this into a report.

--
Paige Miller

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

Do you want this to appear in separate lines in a report? If so, explain further.

 

There really is no concept of "many lines" in a SAS data set, you could insert a carriage break character into the string, but that's really useless unless you want to put this into a report.

--
Paige Miller
Zatere
Quartz | Level 8
Hi @PaigeMiller,

Yes actually this is what I was looking for.

I did the below:

data want;
text_in_many_lines =
cats(
'Hello,',
'0A'x,'0A'x,
'This is a text in many lines.',
'0A'x,'0A'x,
'Thanks.'
)
;
run;
PaigeMiller
Diamond | Level 26

Just out of curiosity, why do you want this in a SAS data set variable?

--
Paige Miller
Zatere
Quartz | Level 8
I use it as body of an email.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 4 replies
  • 2000 views
  • 0 likes
  • 2 in conversation