01-16-2013 01:47 PM
I've got some code which creates an acronym from a department name:
acronym=propcase(prxchange('s/ for | of the | \& |, cio/ /io',1,FullDepartmentName));
It's used in a data step and creates a variable called: acronym - which is the shortened version of FullDepartmentName.
For example: FullDepartmentName="Department of the Interior & Toxicology for Cancer" would create a variable acronym='DITC"
With all the quotes, parens, ampersands, etc, how would i turn this into a macro? Something like:
Note: I was trying to see how little code i could use to create the acronym. If you think you can do it with less code, I'd like to see it
01-16-2013 04:08 PM
acronym=propcase(prxchange('s/ for | of the | \& |, cio/ /io',-1,department));
informat department $80.;
input department &;
Department of the Interior & Toxicology for Cancer
Office for Something
Statistical Analysis System
01-16-2013 07:14 PM
If case might be an issue then this works: