DATA Step, Macro, Functions and more

trim function

Accepted Solution Solved
Reply
Contributor
Posts: 46
Accepted Solution

trim function

Hello all, thanks for the previous replies.The following statements of trim function are from sas Help and Documentation example in sas9.4, but it gives me error any help is appreciated to remove the errors.
data afewords;
input Word1$ Word2$ ;
cards;
*some/ WHERE
*every* THING
*no* BODY
;
proc print data=afewords;run;

 

proc sql;
select trim(both '*' from word1) from afewords;

quit;

proc sql;

select trim(leading '*' from word1) from afewords;

quit;

proc sql;

select trim(trailing '*' from word1) from afewords;

quit;


Accepted Solutions
Solution
‎01-22-2018 12:30 PM
PROC Star
Posts: 8,114

Re: trim function

[ Edited ]

Wrong proc! The function you are trying to use is part of proc fedql. For, example, try the following:

data afewords;
input Word1$ Word2$ ;
cards;
*some/ WHERE
*every* THING
*no* BODY
;

proc print data=afewords;
run;

proc fedsql;
select trim(both '*' from strip(word1))
from afewords
;
quit;

proc fedsql;
select trim(leading '*' from strip(word1))
from afewords
;
quit;

proc fedsql;
select trim(trailing '*' from strip(word1))
from afewords
;
quit;

Art, CEO, AnalystFinder.com

 

View solution in original post


All Replies
Solution
‎01-22-2018 12:30 PM
PROC Star
Posts: 8,114

Re: trim function

[ Edited ]

Wrong proc! The function you are trying to use is part of proc fedql. For, example, try the following:

data afewords;
input Word1$ Word2$ ;
cards;
*some/ WHERE
*every* THING
*no* BODY
;

proc print data=afewords;
run;

proc fedsql;
select trim(both '*' from strip(word1))
from afewords
;
quit;

proc fedsql;
select trim(leading '*' from strip(word1))
from afewords
;
quit;

proc fedsql;
select trim(trailing '*' from strip(word1))
from afewords
;
quit;

Art, CEO, AnalystFinder.com

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 83 views
  • 1 like
  • 2 in conversation