Charlotte Regarding the sun - as we are heading into winter now we have about as much chance of seeing it as in the UK this time of the year! I have the feeling you are being asked to rectify a defect in organisational planning (nothing new in that, except usually technical staff are the last to be consulted). Normally I would expect job codes to be assigned by HR as part of setting up the job descriptions, and these codes would be entered into your database; and it would be the task of the reporting analyst to translate those job codes back into job titles. In this case the titles are already available but someone now feels the need to inflict codes on the organisation. Job and department codes really only serve two useful purposes: saving space in a computer database (not in your case - the database contains the full title) and saving space in financial articles. Hence everybody recognises codes such as CEO, CFO, COO and the like and the become status symbols for the elite, like military decorations (DSO, VC etc). The trouble is that lower down the organisational pyramid there are potentially overlapping codes for quite dissimilar roles. SA, for example, can be Systems Architect, Senior Analyst, or Sales Assistant. Hence the idea of attaching company-department codes to the job codes to distinguish between duplicates. This is making your codes unwieldy. By the way, if job codes were properly implemented in your organisation there would be a database table translating the codes into full titles, and a procedure for updating those tables; and you could use the methods others have suggested to expand codes into descriptions as required. However, if you have no choice to implement codes in the format you have described I would hope you have a source table with the following columns: Company, Department, Level, Position. I changed the order as I think it is more logical to have Company-BD-SM-CFO. Proc Sort data = Job_Titles ; By Company Department Level Position ; Run ; Data Job_Codes ; Set Job_Titles ; By Company Department Level Position ; Length Cmp Dpt Lvl Pos $3 Cmp0 Dpt0 Lvl0 Pos0 $3 job_code $16 k $1 ; Retain Cmp Dpt Lvl Cmp0 Dpt0 Lvl0 Pos0 ; If first.Company then Do ; Cmp0 = Cmp ; Cmp = ' ' ; Do i = 1 to 3; k = Upcase (Scan (Company, i)) ; /* Initial letter */ Substr (Cmp, i, 1) = k ; /* Stuff it into the company code */ End ; If Cmp = Cmp0 then put _All_ ; /* unintended duplicates*/ If first.Department … If first.Level … If first.Position … job_code = catx ('-', cmp, dpt, lvl, pos) ; Drop Cmp Dpt Lvl Cmp0 Dpt0 Lvl0 Pos0 i k ; Run ; KiaOra (I'm really a displaced Kiwi) Richard ISW (Itinerant SAS Wrangler)
... View more