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.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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