- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@PeterClemmensen @RW9 Thanks for your time and suggestion. It work's fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
See also:
creating macro variables via proc sql-remove spaces
https://communities.sas.com/t5/SAS-Programming/creating-macro-variables-via-proc-sql-remove-spaces/m...