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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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 lock in 2025 pricing—just $495!

Register now

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