You’ve just made a ton of changes!
- Save or export the new data set to your computer.
- Edit the codebook to reflect the changes that you made.
- In a production situation, or when changes aren’t being made on a rapid basis, it is common to include the date in the file name.
- Keep the data, codebook and data management file in the same folder.
Sys.Date() function takes the current date from your computer. The value is then formatted nicely for human consumption and added (pasted) to the file name before written to the working directory as a new text file.
SPSS users commonly save cleaned data as a
SAVE outfile='FilePath\depress_sysdate.sav' /KEEP = Variable_Name1 Variable_Name2. EXECUTE.
Saving only selected variables
- In SPSS the
/KEEPstatement demonstrated above only writes the variable names listed to the saved data set. This can be very useful when dealing with data sets with a large number of variables.
- For R users, using
dplyrselect is generally the fastest.