Dear all, would appreciate your help on this.
I have an excel imported data sheet which for the most part looks fine. Within this imported data I have one character variable which for some cases shows ... Now if I try and select variables on the basis that this variable contains ... it selects none. Furthermore when I hover my cursor over the the relevant box on the data screen the pop-up shows a blank line followed by some meaningful text underneath the blank line. I'm guessing then that the character variable in this case is a carriage return followed by text. I want to get rid off the CR and just have the text but I can't seem to get compress or trim to do the trick. Does anyone have any suggestions? Hope my question is clear enough.
Best wishes, Chris
The syntax for taking out all carriage return ('OD'x) and line feed ('OA'x) characters is
comment= Compress(comment,'0D0A'x);
comment= TRANWRD(comment,'0D0A'x,’’);
If you just want to take out the Carriage Return, use this code: comment= TRANWRD(comment,'0D'x,'');
Sarath
www.studysas.blogspot.com
I should add that the closest I have got to a solution is
varname = COMPRESS(varname, ' ',"s")
which does indeed get rid of the leading CR, but also unfortunately gets rid of all blanks in the text which is not quite what I want to do.
The syntax for taking out all carriage return ('OD'x) and line feed ('OA'x) characters is
comment= Compress(comment,'0D0A'x);
comment= TRANWRD(comment,'0D0A'x,’’);
If you just want to take out the Carriage Return, use this code: comment= TRANWRD(comment,'0D'x,'');
Sarath
www.studysas.blogspot.com
The compress statement has worked a treat, many thanks Sarath.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.