Whenever you have modified a dataset in Stata that you want to save you need to do so explicitly, otherwise it will just be cleared from memory. When you do save a dataset it gets saved to the default directory, which can be located with the cd command. In my case on a Windows 10 machine this points to C:\Users\USER_NAME\Documents. If you dont want to clutter your Documents folder with various datasets you can just change default directory, like so:
md Stata\datasets
cd Stata\datasets
sysuse census, clear
save census-dupl
Now a copy of the census.dta named census-dupl.dta gets saved to the new custom directory instead of the default one.