Hi
I have a data like this.
Data abc;
Input name $10. mail $20. Age 2.;
Infile datalines dlm='@';
abc@mas@gmail.com@12
Absh@auuaa@gmail.com@17
asaks@ajhsjk@gmail.com@18
;
Run;
I want output like this
name mail. age
abc mas@gmail.com 12
absh auuaa@gmail.com 17
asaks ajhsjk@gmail.com 18
Thanks in advance
Read separately, and concatenate:
data abc;
infile datalines dlm='@';
input name :$10. mail :$64. _mail :$32. age;
mail = catx('@',mail,_mail);
drop _mail;
datalines;
abc@mas@gmail.com@12
Absh@auuaa@gmail.com@17
asaks@ajhsjk@gmail.com@18
;
run;
Note that using formats without a colon overrides the delimiters.
PS use proper subjects. "base sas" is much too unspecific.
Read separately, and concatenate:
data abc;
infile datalines dlm='@';
input name :$10. mail :$64. _mail :$32. age;
mail = catx('@',mail,_mail);
drop _mail;
datalines;
abc@mas@gmail.com@12
Absh@auuaa@gmail.com@17
asaks@ajhsjk@gmail.com@18
;
run;
Note that using formats without a colon overrides the delimiters.
PS use proper subjects. "base sas" is much too unspecific.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.