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;
substr(whatevervar, 1,10) ? or if whatevervar is numeric, then try: substr(put(whatevervar, 12.), 1,10)
Regards,
Haikuo
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;
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)
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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 save with the early bird rate—just $795!
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.
Ready to level-up your skills? Choose your own adventure.