Hi;
I'm trying to delete/clear the data (.csdb ) before assigning other households in the data file. I mean I just want to remove/clear any previous data that exists before I put other households in this data file.
Many Thanks.
Deleting Data
Re: Deleting Data
You can use the command delcase to remove a single case from a data file https://www.csprousers.org/help/CSPro/d ... ction.html
However if you want to delete all the cases in the file to empty the file it may be simpler to just delete the file using filedelete(). If you do this however, you should first close the file using the command close() and then reopen it again using setfile(). You can do that with logic like the following:
However if you want to delete all the cases in the file to empty the file it may be simpler to just delete the file using filedelete(). If you do this however, you should first close the file using the command close() and then reopen it again using setfile(). You can do that with logic like the following:
string nomFicherAffectations = filename(AFFECTATIONS_DICT);
close(AFFECTATIONS_DICT);
filedelete(nomFicherAffectations);
setfile(AFFECTATIONS_DICT, nomFicherAffectations, create);
close(AFFECTATIONS_DICT);
filedelete(nomFicherAffectations);
setfile(AFFECTATIONS_DICT, nomFicherAffectations, create);
Re: Deleting Data
Thanks Josh; solved! Thanks Again!
-
- Posts: 1792
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: Deleting Data
And even easier way to do this is:
open(AFFECTATIONS_DICT, create);
The create flag removes all cases in the file, creating a brand new file.