I cannot seem to import a fixed format data file. Data is from CDC National Vital Statistics System (downloadable as zip files under the Mortality Multiple Cause Files heading). Part of the challenge is the data file lacks a a true (usable) dictionary, but does have a pdf that can translate into a dictionary (see documentation stored here, such as this specific pdf). I have tried guidance posted on the Stata FAQ, as well as several posts on Statlist (e.g., 1, 2), but cannot seem to make anything work.
I've tried many permutations of code like this:
As well as a more simple version like this:
Including switching commands around, changing from infix to infile to import, using help files (e.g., this one). I've gotten numerous errors, including "file does not contain dictionary" and "dictionary is unrecognized." I've tried embedding dictionary code in my do file, as well as saving it as it's own txt file in the same directory. In all honesty,
I'm clearly missing some key component and I'm sure it's my (user) error. Any help would be greatly appreciated!
Sarah
I've tried many permutations of code like this:
Code:
infix dictionary { _column(19) int record %1f _column(20) int resstat %1f _column(63) int edu %1f _column(64) int eduflag %1f _column(65) int month %2f _column(69) int sex %1f _column(70) int age %4f _column(74) int ageflag %1f _column(75) int ager1 %2f _column(77) int ager2 %2f _column(79) int ager3 %2f } infix using dictionary , using(mort2021us.txt)
Code:
infix using mort2021us.txt infix dictionary { record 19 resstat 20 edu 63 eduflag 64
I'm clearly missing some key component and I'm sure it's my (user) error. Any help would be greatly appreciated!
Sarah
Comment