Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: why do I lose data, and changes my data when I create new variables and recode missing variables


From   "Svend Juul" <[email protected]>
To   <[email protected]>
Subject   Re: st: why do I lose data, and changes my data when I create new variables and recode missing variables
Date   Mon, 2 Apr 2007 18:21:43 +0200

Muuszls asked:
 
"why do I lose data when I create new variables and recode missing variables?"
 
and Friedrich gave the sensible comment:
 
It is impossible to answer your question "Is there something wrong
with how I save or open things?" because you don't show us how you
save or open your data. I suggest that you -summarize- gdivs after
each -replace- and other command that modifies your data to identify
the culprit. Maybe you are changing gdivs somewhere in your code
because a command is mistakenly applied to gdivs instead of the
intended variable.
-------------------------------------------------------------------
 
I don't know how you do things, but a strong recommendation is to
use do-files when making modifications to data. A modifying do-file
should start with a -use- command reading the data and end with 
a -save- command saving the modified dataset with a NEW name, thus
avoiding to overwrite original data:
 
------------------------------
cd "C:\the directory for this project"
use mydata1.dta , clear
 
    modifying commands
 
save mydata2.dta
------------------------------
 
Try that - and show us the full do-file in case you still encounter
problems.
 
Svend
 
________________________________________________________ 
 
Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6 
DK-8000 Aarhus C,  Denmark 
Phone, work:  +45 8942 6090 
Phone, home:  +45 8693 7796 
Fax:          +45 8613 1580 
E-mail:       [email protected] 
_________________________________________________________ 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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