BookmarkSubscribeRSS Feed
GeorgeSAS
Lapis Lazuli | Level 10

Hello everyone,

 

After I read an excel file into SAS,I found the variable were splited in to several rows, maybe there are something like ENTER keys in the excel file.

 

My question is how to remove these 'split' in sas data set and make the variable in one row?  I want to do this because I can't use 'findw'  function correctly to find a special character in it.  the variable X looks like this:

 

X=des2MKDWhaghv,Machinachinable
DSZCF3DigitRuralMachinableWs,
DSCWF73
DiitNoralMJchinableSghtTY


I need x like this:

 

X=des2MKDWhaghv,MachinachinableDSZCF3DigitRuralMachinableWs,DSCWF73DiitNoralMJchinableSghtTY

 

I have tried use compress(x) but still not work.

 

Thanks

3 REPLIES 3
SASKiwi
PROC Star

Try COMPRESS with the S modifier. It removes print control characters as well:

compress(x, ,'S');
Ksharp
Super User
new=compress(x,'0D0A'x);
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Pleas show exactly how your data is, do all those lines appear in one observation in SAS (post a sample of the excel file maybe)?  I assume that this is on import, but when I did this, simple proc import on an Excel file, it put the whole record on one observation and removed alt+enters.  So I don't see why you have this issue.  Please explain your process further.

sas-innovate-2024.png

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.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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