File Utilities: Converting, Reformatting and More
Converting File Formats
- Software can convert among over 20 data formats
- Available in Lehman Library's DSSC on the 10 workstations with single 30" monitors and on the lower level of DSSC in Data Service.
- Options within SAS, Stata and SPSS
Although StatTransfer's versatility makes it the preferred way to convert files, when it is not available there are other options.
Can read SAS, Stata, Excel, dBase, and ASCII fixed format or delimited files
Can read Excel, SAS export files and ASCII fixed format or delimited files
Can read Excel, dBase and ASCII fixed format or delimited files
Frequently Used Data Reformatting Tools in Stata
As per the Guidelines for DSSC Support for Data, staff can help you get your data ready for use. This includes procedures like with merging, subsetting, joining, and recoding. Here are examples of techniques we use:
- Stata: taking samples
Use the sample command.
- a 10% sample
- sample of a subset
by sex: sample 10
- a number sample (for sample with 100 records)
sample 100, count
- a contest winner
sample 1, count
- sample based on record number (every 10th record)
keep if mod(_n,10)==0
- a 10% sample
- Stata: Strings into Numbers
Use the destring command.
- In codebook, check that valid values do not include alpha characters
- To destring variable age_wed
- The force option generates missing for alpha characters
- Stata: add leading zeros to a number.
- Convert number variable, say ID_N to a string variable called ID_S
- gen str3 ID_Z = string(ID,"%03.0f")
- values like 1 11 103 will become 001 011 103