Help using Base SAS procedures

how to remove row split key from a data

Reply
Regular Contributor
Posts: 201

how to remove row split key from a data

[ Edited ]

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

Super User
Posts: 3,101

Re: how to remove row split key from a data

[ Edited ]

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

compress(x, ,'S');
Super User
Posts: 9,671

Re: how to remove row split key from a data

new=compress(x,'0D0A'x);
Super User
Super User
Posts: 7,392

Re: how to remove row split key from a data

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.

Ask a Question
Discussion stats
  • 3 replies
  • 281 views
  • 0 likes
  • 4 in conversation