Help using Base SAS procedures

proc sql trim

Accepted Solution Solved
Reply
Regular Contributor
Regular Contributor
Posts: 238
Accepted Solution

proc sql trim

I want to trim the end 2 numbers from a column and normally can just do a trim statement but not working right.

Here is my code:

proc sql;

create table implants.alldrgs_sum as

(select distinct

trim(left(clm_aud_nbr),10) as ClaimNum,

sys_drg,

drg_desc,

alloc_rvnu_cd,

funding,

alloc_allw_amt,

epd_calc_allw_amt,

alloc_net_pd_amt

from implants.implants_aso_alldrgs_copy

group by clm_aud_nbr);

run;


Accepted Solutions
Solution
‎04-30-2012 05:11 PM
Super User
Super User
Posts: 6,502

Re: proc sql trim

The TRIM() function does not take any numeric parameters.  What is it you want to do?

If CLM_AND_NBR is a character variable then use SUBSTR() function to take the first 10 characters.

If CLM_AND_NBR is a number what do you want to do?  Convert it to a string?  You could use the PUT() function.

View solution in original post


All Replies
Solution
‎04-30-2012 05:11 PM
Super User
Super User
Posts: 6,502

Re: proc sql trim

The TRIM() function does not take any numeric parameters.  What is it you want to do?

If CLM_AND_NBR is a character variable then use SUBSTR() function to take the first 10 characters.

If CLM_AND_NBR is a number what do you want to do?  Convert it to a string?  You could use the PUT() function.

☑ This topic is SOLVED.

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

Discussion stats
  • 1 reply
  • 2657 views
  • 0 likes
  • 2 in conversation