Joe McCrary writes:
> I've got a number of tab-delimited text files that I'm reading into
> STATA 8.2 using insheet. The problem I'm having is that the first 3
> variables need to be read is as text, not numeric. Here is one line of
> data:
>
> 86309 0060 010051000229 0 84 69 66
> 48 69 75 84 78 87 81 75
> 63 69
>
> In looking over the infile/dictionary commands, it appears that I
> cannot specify a delimeter in the dictionary file.
>
> Could someone please tell me how to read those first 3 in as strings?
You can use a dictionary with tab delimiters... For example, create:
dictionary using test.raw {
str5 v1
str4 v2
str12 v3
int v4
int v5
int v6
int v7
int v8
int v9
int v10
int v11
int v12
int v13
int v14
int v15
int v16
int v17
}
and save as test.dct. Then:
. infile using test.dct
dictionary using test.raw {
str5 v1
str4 v2
str12 v3
int v4
int v5
int v6
int v7
int v8
int v9
int v10
int v11
int v12
int v13
int v14
int v15
int v16
int v17
}
(3 observations read)
. list
+-----------------------------------------------------------------------------------------------------------+
| v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12 v13 v14 v15 v16 v17 |
|-----------------------------------------------------------------------------------------------------------|
1. | 86309 0060 010051000229 0 84 69 66 48 69 75 84 78 87 81 75 63 69 |
2. | 86309 0060 010051000229 0 84 69 66 48 69 75 84 78 87 81 75 63 69 |
3. | 86309 0060 010051000229 0 84 69 66 48 69 75 84 78 87 81 75 63 69 |
+-----------------------------------------------------------------------------------------------------------+
-----------------------------------------
CONFIDENTIALITY NOTE: This e-mail message, including any attachment(s),
contains information that may be confidential, protected by the
attorney-client or other legal privileges, and/or proprietary non-
public information. If you are not an intended recipient of this
message or an authorized assistant to an intended recipient, please
notify the sender by replying to this message and then delete it from
your system. Use, dissemination, distribution, or reproduction of this
message and/or any of its attachments (if any) by unintended recipients
is not authorized and may be unlawful.
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/