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)
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: