BookmarkSubscribeRSS Feed

The purpose of CATXF would be to concatenate formatted values with a delimiter.

CATXF(format, delimiter, item-1 <, ... item-n>)

If format is not present use the variables format attribute.

A null delimiter would be a null delimiter (not an implicit 1-space)

 

Example:

array items (5) _temporary_ (1:5);
result = catxf(z4., '', of items(*));

Result

00010002000300040005
5 Comments
mkeintz
PROC Star

I like this idea - great for creating fixed format raw data, among other benefits.

 

I especially the proposal that the absence of a format tells SAS to use the format attribute, which would be a VERY handy way to concatenate mixed formats.

Reeza
Super User
snoopy369
Barite | Level 11

I feel like this might be something that could be added to CATQ, at minimum, given it already takes a modifier.  Of course we don't always want the quoting, but most of the time it either is helpful or more often won't actually happen in practice, and if that meant this was easier to add (adding a whole function might be much harder than adding functionality to a function?), I'd be all for it.  Worst case could always remove quotes later, right?

yabwon
Onyx | Level 15
Tom
Super User
Super User

Interesting. 

Just a note on your example.  You have NOT provided a NULL delimiter in your function call.  Just typing two quotes next to each other does NOT make a null value in SAS syntax, it makes an empty character string of length 1.  So a single space character.

 

So either change you function call to one of these:

result = catxf(z4., , of items(*));
result = catxf(z4., trimn(' '), of items(*));

Or change the results produced by your example to reflect the values passed in the function call:

0001 0002 0003 0004 0005