☑ This topic is solved.
Need further help from the community? Please
sign in and ask a new question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 05-09-2022 04:18 AM
(1100 views)
data aadhar ;
input aadhar $ 28.;
datalines ;
1727-8514-4648
;
run;
data mask;
set aadhar;
new=substr(aadhar,length(aadhar)-1,9)='xxxx';
run;
I want to mask the first 8 numbers
required output
xxxx-xxxx-4648
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
data aadhar ; input aadhar $ 28.; datalines ; 1727-8514-4648 ; run; data mask; set aadhar; new=prxchange('s/\d+/xxxx/',2,aadhar); run;
4 REPLIES 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Will all values have the format of <4 digits><hyphen><4 digits><hyphen><4 digits>?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
data aadhar ; input aadhar $ 28.; datalines ; 1727-8514-4648 ; run; data mask; set aadhar; new=prxchange('s/\d+/xxxx/',2,aadhar); run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi
Sharp
Thank you for your solution I am not good at regular expressions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Then check documentation and learn it . It is a must-have skill for sas programmer .