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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 974 views
  • 0 likes
  • 2 in conversation