BookmarkSubscribeRSS Feed
sreeram
Fluorite | Level 6
i have variable with value, example: N01221-0123-0101. i just need the value as
N01221-123-0101. by deleting a zero from the right in the middle one (i.e 0123 to 123). can you write it Message was edited by: sreeram
2 REPLIES 2
sreeram
Fluorite | Level 6
This below code is working thanks for your help GOD.

if substr(usubjid,6,1) = '0' then substr(usubjid,6,4)=substr(usubjid,7,3);
breaks=substr(usubjid,10,5);
usubjid=substr(usubjid,1,8)||strip(breaks);
SPR
Quartz | Level 8 SPR
Quartz | Level 8
Hello Sreeram,

How about this:
[pre]
data i;
s='N01221-0123-0101';
i=INDEX(s,'-');
r=SUBSTR(s,1,i)||SUBSTR(s,i+2);
run;
[/pre]
Sincerely,
SPR

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 2 replies
  • 1035 views
  • 0 likes
  • 2 in conversation