Page 1 of 1

Export To Stata: 2+ Multiple-Occurence Records

Posted: April 13th, 2024, 8:00 am
by slwendo
Hi,

I've tried exporting data from csdb to STATA (CSPro 7.7) where my dictionary more than 1 records that have a max occurence >1. The output Stata file is always missing one of the multi-occuring records. What could be the problem?

Dictioanry structure:

MYDICTIONARY
- ID
- HH_REC [Max Occ = 1]
- POP_REC [Max Occ = 100]
- MORT_REC [Max Occ = 20]
- ROS_REC [Max Occ = 100]
- META_REC [Max Occ = 1]
- HH_DETAILS [Max Occ = 1]
- IND_DETAILS [Max Occ = 1]

When I export using the Export tool (from Data Viewer), One of POP_REC, MORT_REC, ROS_REC is always missing.

The specifics on my export are
Number of Files Created: One File
Output of Multiple Record Occurences: As Seperated Records and Join Single with Multiple Records
Export Format: Stata (.dat, .dct, .do)
Export Record Type: Before ID Items
Export Items or Subitems: Items Only
Additional Options: None

Re: Export To Stata: 2+ Multiple-Occurence Records

Posted: April 15th, 2024, 10:29 am
by Gregory Martin
Exporting data from cases where multiple records contain multiple occurrences is always tricky. Your best options are:

1) Change the Output... to "All in One Record."

2) Keep "As Separate Records" but run multiple exports, one for each repeating record, and then combine the data in Stata.

Essentially the problem is that the text-based export to Stata doesn't properly support using multiple lines of data to represent different multiply-occurring records.

You might also consider using a batch application to write your data to the Stata data source: https://www.csprousers.org/help/CSPro/d ... stata.html