I am having trouble importing a flat file (.raw) using a data dictionary that was given to me. The data and the dictionary have the same name -- so let's say NAME.raw is the data file and NAME.dct is the dictionary. The person who gave me the dictionary also gave me a log showing that this code below works to import the data w/ the dictionary. It begins this way (identical to true log but with NAME instead of true file name):
I'm not sure if it's necessary for the .raw file and the .dct file to have the same name -- the help file for infix is hard to follow -- but I'm guessing that it is necessary for the syntax in the log. Clearly the data imported for the person who gave me the log; the log goes on to manipulate the data. But when I run this same code from a .do file in the same folder as the 2 files (i.e., in the folder with NAME.raw, NAME.dct), I can see from the output that I'm accessing the .dct file but apparently the .raw file is not being found, as I get this error at the bottom:
Any help would be greatly appreciated.
Code:
. clear . infix using NAME infix dictionary using NAME.raw { study 1-2 deck 3-4 intno 5-8 serno1 9 type1 10 period1 11 nperiods1 12-14 avsal1 15-18 tosal1 19-23 serno2 24 type2 25 period2 26 nperiods2 27-29 avsal2 30-33 tosal2 34-38 serno3 39 type3 40 period3 41 nperiods3 42-44 avsal3 45-48 tosal3 49-53 serno4 54 type4 55 period4 56 nperiods4 57-59 avsal4 60-63 tosal4 64-68 } '-' cannot be read as a number for serno3[229] (2,376 observations read)
Code:
. infix using NAME
infix dictionary using NAME.raw {
study 1-2
deck 3-4
intno 5-8
serno1 9
type1 10
period1 11
nperiods1 12-14
avsal1 15-18
tosal1 19-23
serno2 24
type2 25
period2 26
nperiods2 27-29
avsal2 30-33
tosal2 34-38
serno3 39
type3 40
period3 41
nperiods3 42-44
avsal3 45-48
tosal3 49-53
serno4 54
type4 55
period4 56
nperiods4 57-59
avsal4 60-63
tosal4 64-68
}
file NAME.raw not found
dictionary invalid
Comment