help use10save9 (vs1.1: 2011-10-25)
-------------------------------------------------------------------------------

Title

use10save9 -- Saving matched files in Stata 9 format - either as new files in a > utomatically created directory or through replacing previous Stata 10+ files.

Syntax

use10save9 [, folder(string) match(string) prefix(string) suffix(string) subs replace]

Description

use10save9 is a program that helps out with opening Stata 10+ files from within Stata 9 and then saving them in Stata 9 format (using use10 and save9). May be applied to a quite generally defined set of Stata datasets within a defined folder and, if selected, also with respect to all corresponding subfolders. The simplest syntax is purely based on defaults. All options are optional.

An alternative, secondary, usage might be to simply use the function as an extension to save9 (Ercolani, 2011) in order to save matched sets of datasets in Stata 9 format while being in Stata 10+.

Options

folder(string) Defines the directory from within where to look for files. The default directory is the current working directory (cwd; '.').

match(string) Defines the matching criterion used in order to select files from the selected directory folder. The default is all files in the directory ('*').

prefix(string) Defines a prefix string to put in front of all new files corresponding to matched cases.

suffix(string) Defines a suffix string to put at the end of all new files corresponding to matched cases.

subs An indicator for whether, or not, matched files in corresponding subdirectories (recursively) also should be affected.

replace An indicator for whether, or not, the matched files should be saved as new files in subdirectory 'stata9'(which is then - if not existing - automatically created) or rather simply be saved (with 'replace') in folder (potentially overwriting, if no prefix/suffix assigned, the old versions).

Examples

--------------------------------------------------------------------------- 1. Save all (Stata dataset) files in current working directory in Stata 9 format in subdirectory 'stata9'. . use10save9

--------------------------------------------------------------------------- 2. Save all files with prefix name located in cwd-subdirectory data in Stata 9 format in subdirectory 'stata9'. . use10save9 , folder(".\data") match("name*")

--------------------------------------------------------------------------- 3. Same as Example 2, but in this case all matched files in subdirectories to folder data are also to be affected. . use10save9 , folder(".\data") match("name*") subs

---------------------------------------------------------------------------

4. Same as Example 2, but in this case all matched files in folder data should simply be saved replacing the original ones. . use10save9 , folder(".\data") match("name*") replace

--------------------------------------------------------------------------- 5. Same as Example 4, but in this case all new files will have prefix 's9_' added to filenames (e.g. to avoid overwriting). . use10save9 , folder(".\data") match("name*") prefix("s9_") replace

---------------------------------------------------------------------------

Requires

Stata 9; user written functions use10 (Radyakin, 2008) & save9 (Ercolani, 2011)

Author

Lars Ängquist la@ipm.regionh.dk lars.angquist@telia.com

Also see

Help: [help pages on] use10 (user-written), save9 (user-written), save, varlist, string functions.