BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
pavank
Quartz | Level 8

data dsn;
input email $20.;
datalines;
Abc@123Ind
cd!345Aus
thr%34344Us
;
run;

 

output Like below

Abc@123IND
cd!345AUS
thr%34344US

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26
data want;
    set dsn;
    first=cats(scan(email,1,'@!%'));
    delim=substr(email,length(first)+1,1);
    second=upcase(scan(email,2,'@!%'));
    email=cats(first,delim,second);
    drop first delim second;
run;

 

May I ask ... why? What is the benefit of converting parts of email addresses to capital letters? There is no requirement that e-mails addresses be capitalized.

--
Paige Miller

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26
data want;
    set dsn;
    first=cats(scan(email,1,'@!%'));
    delim=substr(email,length(first)+1,1);
    second=upcase(scan(email,2,'@!%'));
    email=cats(first,delim,second);
    drop first delim second;
run;

 

May I ask ... why? What is the benefit of converting parts of email addresses to capital letters? There is no requirement that e-mails addresses be capitalized.

--
Paige Miller
pavank
Quartz | Level 8

Hi @PaigeMiller I  do agree with you  

Interview panel asked these type of questions 

PaigeMiller
Diamond | Level 26

Ok, thanks. Pointless question, asking someone how to do work that doesn't need to be done.

--
Paige Miller
Ksharp
Super User
data dsn;
input email $20.;
datalines;
Abc@123Ind
cd!345Aus
thr%34344Us
;
run;

data want;
 set dsn;
 want=prxchange('s/([a-z]+$)/\U\1/',1,strip(email));
run;

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 4 replies
  • 663 views
  • 0 likes
  • 3 in conversation