SAS Data Science

Building models with SAS Enterprise Miner, SAS Factory Miner, SAS Viya (Machine Learning), SAS Visual Text Analytics, with point-and-click interfaces or programming
BookmarkSubscribeRSS Feed
azorachase
Calcite | Level 5

Hello,

 

I am working in SAS to manipulate a dataset that I will export into word.

 

Right now, my address variable is written as a single line; for example:

Address="123 Apple Way Anytown, NY 12345"

 

I would like to modify the format so that when it exports into excel, it will appear in the same cell, across two lines. In other words, I would like to force a carriage return so that the address appears as:

123 Apple Way

Anytown, NY 12345

 

Any thoughts are greatly appreciated! Thanks in advance.

1 REPLY 1
LaurieF
Barite | Level 11

This works for me (in SAS Studio, reading the spreadsheet back in via Apple's Numbers😞

 

libname xl xlsx "&_sasws_/test.xls";

data xl.test;
a = "123 Apple Way Anytown, NY 12345";
b = catx('0d0a'x, scan(a, 1, ','), scan(a, 2, ','));
output;
run;
libname xl clear;

Alternatively, and this seems to work too:

b = tranwrd(a, ',', '0d0a'x);

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 3502 views
  • 0 likes
  • 2 in conversation