Prashant,
What do you mean by "even when the old demographic data format might
be different across departments"? Are the old files not standardized
according to the previous payroll system? If the layout of the files
is the same across different departments you can write a do-file that
loops over the old files, reformats them and saves them in the new
format.
local filelist: dir . files "*.dta"
foreach file of local filelist {
use "`file'"
gen newvar1 = oldvar1
gen newvar2 = oldvar2
* Create other variables, format data, etc.
drop oldvar1 oldvar2
save "`file' new"
}
Friedrich
On Wed, Oct 8, 2008 at 6:07 PM, Prashant Shukla
<[email protected]> wrote:
> Say we have some demographic data on the employees of the statistics
> department of a University. It contains data like First Name, Last name,
> Date of Birth, Hire Date, various address fields etc, etc. Also, let's
> assume it has 30 variables.
>
> Now say the department is shifting payroll systems and this data needs
> to be in a "new" format so that the new system can accept it. So this
> new demographic file needs to have 40 variables, much of it coming from
> our old demographic file, but some to be created and left blank. So you
> know, the formats for dates are different and address fields have
> different labels but much of the data is being mapped from the old file.
>
> As I said, we could just work on the original data set to format it to
> suit the new system. But, if I am doing this not just for the statistics
> department, but all the departments at the university, then I would much
> rather write one program that can map the data across to the standard
> format for the new payroll system, even when the old demographic data
> format might be different across departments.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/