BookmarkSubscribeRSS Feed
tmm
Fluorite | Level 6 tmm
Fluorite | Level 6

I need the substr to take the first 10 characters of the 12 characters. It is a text and looks similiar to this:

11111111101

I need to drop the 01 off the end.

proc sql;

create table implants.alldrgs_sum as

(select distinct

substr(clm_aud_nbr,2,10) as ClaimNum,

sys_drg_cd,

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;

3 REPLIES 3
Haikuo
Onyx | Level 15

substr(whatevervar, 1,10) ? or if whatevervar is numeric, then try:  substr(put(whatevervar, 12.), 1,10)

Regards,

Haikuo

Linlin
Lapis Lazuli | Level 10

data have;

length tt $ 11;

input id tt;

cards;

1 11111111101

2 21111111101

3 11111111101

4 21111111101

5 31111111101

;

proc sql;

  create table want as

    select distinct(substr(tt,1,length(tt)-2)) as newtt

   from have;

quit;

proc print;run;

MikeZdeb
Rhodochrosite | Level 12

hi ... you could also use a PUT statement as follows ...

data have;

input id clm_aud_nbr : $12. @@;

cards;

1 111111111101 2 211111111101 3 111111111101 4 211111111101 5 311111111101

;

proc sql;

create table want as

select id, put(clm_aud_nbr,$10.) as claimnum from have;

quit;


one advantage is that using PUT gives CLAIMNUM a length of 10


using SUBSTR gives CLAIMNUM a length of 12 (same length as CLM_AUD_NBR)

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 3 replies
  • 2378 views
  • 1 like
  • 4 in conversation