Hello Statalist friends,
I have an ASCII file that is in fixed format, and I know the layout of the variables. I've written a dictionary to read in the observations to Stata.
Here is an example of an observation in the ASCII file (I skipped the variables that are unavailable, which was originally just empty space, and this does not affect the meaning of my question):
Claim2094IFNWC201406030745MOCA20140603201406032014 06032014071800000000FLFL09002227005200340000003333
I know exactly the layout of the variables, so I create a dictionary for Stata to read in the data, below is an example of my dictionary:
str5 record 1-5
int client 4-7
str3 vendor 40-42
str2 line 46-47
long date_of_incident 48-55
Many of the observations in my ASCII file contain different variables. So for example, below are three different observations in the ASCII file (one observation for each line):
Claim2094IFNWC201406030745MOCA20140603201406032014 06032014071800000000FLFL09002227005200340000003333
Payment2094IFNC384411842015042420150424PNN00000000 YN1500000920FSYS649
Status2094IFN20140718113018CAN000000281841.700
I only need the observations that with a record type "Claim", and don't need the observations starting with "payment" or "status". I add a command at the end of the dictionary: if record=="claim". However, I am not able to run my infix command and Stata gives me error message "dictionary invalid". I suspect this is because the observations have different variables/columns, and Stata is not able to skip other observations and only read in the ones that I need?
Is my suspicion correct? How can I ask Stata to only read in the observations that only start with "Claim"?
Any suggestions are appreciated!
I have an ASCII file that is in fixed format, and I know the layout of the variables. I've written a dictionary to read in the observations to Stata.
Here is an example of an observation in the ASCII file (I skipped the variables that are unavailable, which was originally just empty space, and this does not affect the meaning of my question):
Claim2094IFNWC201406030745MOCA20140603201406032014 06032014071800000000FLFL09002227005200340000003333
I know exactly the layout of the variables, so I create a dictionary for Stata to read in the data, below is an example of my dictionary:
str5 record 1-5
int client 4-7
str3 vendor 40-42
str2 line 46-47
long date_of_incident 48-55
Many of the observations in my ASCII file contain different variables. So for example, below are three different observations in the ASCII file (one observation for each line):
Claim2094IFNWC201406030745MOCA20140603201406032014 06032014071800000000FLFL09002227005200340000003333
Payment2094IFNC384411842015042420150424PNN00000000 YN1500000920FSYS649
Status2094IFN20140718113018CAN000000281841.700
I only need the observations that with a record type "Claim", and don't need the observations starting with "payment" or "status". I add a command at the end of the dictionary: if record=="claim". However, I am not able to run my infix command and Stata gives me error message "dictionary invalid". I suspect this is because the observations have different variables/columns, and Stata is not able to skip other observations and only read in the ones that I need?
Is my suspicion correct? How can I ask Stata to only read in the observations that only start with "Claim"?
Any suggestions are appreciated!
Comment