BookmarkSubscribeRSS Feed
mmkr
Quartz | Level 8

I am trying to combine two columns and add a enter or next line the values , can you help me ?

 

data test;
x="himom";
y="hidad";
;
run;


data want;
set test ;
length D $50 ;
d = catx('0D0A'x,x,y);
run;

proc print data=want;run;

 

Result i want :

 

newcolumn

-----------

himom

hidad

4 REPLIES 4
ballardw
Super User

Where do you expect this to appear? It might be possible for some ODS destinations but it may be that the approach is different for different file types.

And basically isn't going to appear in a data set view.

mmkr
Quartz | Level 8
in Proc report i would like to sipaly
mkeintz
PROC Star

I don't think there is a way for PROC PRINT to honor linefeed/carriage returns within the value of a single Cell.

 

I wonder if there are any PROC REPORT honchos seeing this question can provide a solution.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
Tom
Super User Tom
Super User

ENTER is a KEY, not a CHARACTER.  I suppose the character you might want is a LINEFEED, '0A'x, or CARRIAGE RETURN, '0D'x.

 

But you are probably better off inserting something that PROC REPORT will recognize as a line break.

 

See this thread for example.  https://communities.sas.com/t5/SAS-Procedures/Multiple-lines-in-a-PROC-REPORT-cell/td-p/312811

 

sas-innovate-wordmark-2025-midnight.png

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
  • 4 replies
  • 583 views
  • 1 like
  • 4 in conversation