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.
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);
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.