[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: RE: follow up on Stata

From   "Prashant Shukla" <>
To   <>
Subject   RE: st: RE: follow up on Stata
Date   Thu, 9 Oct 2008 04:17:39 +0100

Hi Friedrich,

Thanks for the input. I was just allowing for the possibility of
different payrolls across different departments. But, you answer is in
the vein of what I was trying to accomplish: come up with a do-file that
can transform a file format into a different one, with additions
modifications etc multiple times. I will try the following and get back
to you. Thanks so much again,


-----Original Message-----
[] On Behalf Of Friedrich
Sent: Wednesday, October 08, 2008 6:13 PM
Subject: Re: st: RE: follow up on Stata


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

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"


On Wed, Oct 8, 2008 at 6:07 PM, Prashant Shukla
<> wrote:
> Say we have some demographic data on the employees of the statistics
> department of a University. It contains data like First Name, Last
> 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
> our old demographic file, but some to be created and left blank. So
> know, the formats for dates are different and address fields have
> different labels but much of the data is being mapped from the old
> 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
> department, but all the departments at the university, then I would
> 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:

*   For searches and help try:

© Copyright 1996–2023 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index