BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
AshokD
Obsidian | Level 7

Hi All,

 

In data step we have STRIP function which removes leading and trailing spaces.

Do we have any similar function in Proc SQL ?

 

Please share your thoughts.

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

You can use the Strip Function in PROC SQL as well

 

data test1;
string="     Hello  ";
run;

proc sql;
   create table test2 as
   select strip(string) as newstring
   from test1;
quit;

View solution in original post

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Yes.  If your using the inbuilt SQL parser in SAS then that parser can use SAS functions.  If your passing through the SQL statement to a database, then you would need to use functions that the database knows in your code rather than SAS functions.  

PeterClemmensen
Tourmaline | Level 20

You can use the Strip Function in PROC SQL as well

 

data test1;
string="     Hello  ";
run;

proc sql;
   create table test2 as
   select strip(string) as newstring
   from test1;
quit;
AshokD
Obsidian | Level 7

@PeterClemmensen @RW9 Thanks for your time and suggestion. It work's fine.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 38274 views
  • 3 likes
  • 4 in conversation