0% found this document useful (0 votes)
44 views4 pages

Use SAS Function Propcase

This macro takes a CSV file exported from Google Contacts and processes it to prepare it for reimporting into Google Contacts. It uses the SAS PROPCASE() function to format names properly, removes duplicate contacts, and merges email and phone contacts into single records with both email and phone. The processed file is then exported as CSV ready for reimporting. The macro demonstrates how to use SAS to clean up contact data from Google Contacts.

Uploaded by

Nagesh Khandare
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views4 pages

Use SAS Function Propcase

This macro takes a CSV file exported from Google Contacts and processes it to prepare it for reimporting into Google Contacts. It uses the SAS PROPCASE() function to format names properly, removes duplicate contacts, and merges email and phone contacts into single records with both email and phone. The processed file is then exported as CSV ready for reimporting. The macro demonstrates how to use SAS to clean up contact data from Google Contacts.

Uploaded by

Nagesh Khandare
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

Use SAS function Propcase() to streamline Google Contacts

You might think I am crazy...but I have been using this macro for a long time to fix some contacts in my Google
Contacts...I get a little irritated when I can't find a particular person by email...so I wrote this macro...
his macro takes for Input a .csv file that is exported from Google Contacts and outputs a file that is ready to be imported
to Google Contacts....often I wanted to have !ames in the proper case...
ry it yourself and let me know if it needs any tweaks...
"ropcase in #$# %ocumentation.
%macro organizeGoogleContacts&infile'outfile()
*+Import your contacts into #$# +*
data googlegroups)
infile ,-infile, dlm.''' dsd lrecl.32767 firstobs.2)
length !ame Given!ame $dditional!ame /amily0!ame Yomi0!ame Given0!ame0Yomi
$dditional0!ame0Yomi /amily0!ame0Yomi !ame0"refix !ame0#uffix Initials !ickname
#hort0!ame 1aiden0!ame 2irthday Gender 3ocation 2illing0Information
%irectory0#erver 1ileage 4ccupation 5obby #ensitivity "riority #ub6ect !otes
Group01embership 70mail08000ype 70mail080009alue "hone08000ype
"hone080009alue "hone0:000ype "hone0:0009alue "hone0;000ype
"hone0;0009alue 4rganization08000ype 4rganization08000!ame 4rganization08000Yomi0!ame
4rganization08000itle 4rganization08000%epartment 4rganization08000#ymbol
4rganization080003ocation 4rganization08000<ob0%escription = 40)
input !ame Given!ame $dditional!ame /amily0!ame Yomi0!ame Given0!ame0Yomi
$dditional0!ame0Yomi /amily0!ame0Yomi !ame0"refix !ame0#uffix Initials !ickname
#hort0!ame 1aiden0!ame 2irthday Gender 3ocation 2illing0Information
%irectory0#erver 1ileage 4ccupation 5obby #ensitivity "riority #ub6ect !otes
Group01embership 70mail08000ype 70mail080009alue "hone08000ype
"hone080009alue "hone0:000ype "hone0:0009alue "hone0;000ype
"hone0;0009alue 4rganization08000ype 4rganization08000!ame 4rganization08000Yomi0!ame
4rganization08000itle 4rganization08000%epartment 4rganization08000#ymbol
4rganization080003ocation 4rganization08000<ob0%escription)
run)

*+ /or unnamed contacts use the 7mail username as the !ame +*
data names)
set googlegroups)
if name.'' and 70mail080009alue ne '' then name.propcase&lowcase&scan&70mail080009alue'''>'((()*+/ormat the
names with camelcase+*
else name.propcase&upcase&name(()*+/ormat the names with camelcase+*
run)

*+ ?emove any duplicates by name*email*phone contacts +*
proc sort data.names out.googlecontacts nodupkey)
by name 70mail080009alue "hone080009alue)
where 70mail080009alue ne '' or "hone080009alue ne '')
run)

*+ 1any a times one contact may have been noted down with email contacts only +*
proc sort data.googlecontacts out.email nodupkey)
by name)
where 70mail080009alue ne '')
run)

*+ 1any a times one contact may have been noted down with "hone number only +*
proc sort data.googlecontacts out.phone nodupkey)
by name)
where "hone080009alue ne '')
run)

*+ 1erge the email and "hone contacts by name to get the email and phone on to one record +*
data merged)
merge email phone)
by name)
run)

*+ 7xport it out to Google csv once again... +*
"?4C 7@"4? %$$. A4?B.1erged
4C/I37.,-outfile,
%21#.C#9 ?7"3$C7)
?C!)

*+ %elete all Aork datasets proactively +*
proc datasets lib.work)
delete 0all0)
Duit)
%men! organizeGoogleContacts)

Elet infile.CFG%ocuments and #ettingsG#$#echiesG%esktopGgoogle.csv)
Elet outfile.CFG%ocuments and #ettingsG#$#echiesG%esktopGGoogleContacts.csv)

EorganizeGoogleContacts&-infile'-outfile()
"ou mig#t also li$e%
#$# Interview Huestions and $nswers&:(
#$# macro to reorder dataset variables in alphabetical order
#$# 1acro to Create a delimited text file from a #$# data set..
#$# Interview Huestions and $nswers&8(
?ead full article > httpF**sastechies.blogspot.com*:IIJ*88*useKsasKfunctionKpropcaseKtoKstreamline.html

You might also like