📄 infix.hlp
字号:
{smcl}
{* 23feb2005}{...}
{cmd:help infix}{right:dialog: {bf:{dialog infix}}}
{hline}
{title:Title}
{p2colset 5 33 35 2}{...}
{p2col :{hi:[D] infix (fixed format)} {hline 2}}Read ASCII (text) data in
fixed format{p_end}
{p2colreset}{...}
{title:Syntax}
{p 8 14 2}
{cmd:infix}
{helpb using}
{it:dfilename}
{ifin}
[{cmd:,} {opt using(filename2)} {opt clear}]
{p 8 14 2}
{cmd:infix}
{it:specifications}
{helpb using}
{it:filename}
{ifin}
[{cmd:,} {opt clear}]
{pstd}
where {it:dfilename}, if it exists, contains
{hline 21} top of dictionary file {hline 3}
{opt infix dictionary} [{opt using} {it:filename}] {cmd:{c -(}}
{opt * comments preceded by}
{opt * asterisk may appear freely}
{it:specifications}
{cmd:{c )-}}
{it:(your data might appear here)}
{hline 21} end of dictionary file {hline 3}
{pstd}
and where {it:specifications} is
{p 8 14 2}{it:#} {opt first:lineoffile}{p_end}
{p 8 14 2}{it:#} {opt lines}{p_end}
{p 8 14 2}{it:#}{cmd::}{p_end}
{p 8 14 2}{cmd:/}{p_end}
{p 8 14 2}[{opt byte}|{opt int}|{opt float}|{opt long}|{opt double}|{opt str}]
{varlist} [{it:#}{cmd::}]{it:#}[{cmd:-}{it:#}]{p_end}
{p 4 6 2}
If {it:dfilename} is specified without an extension, {opt .dct} is assumed.
{p_end}
{p 4 6 2}
If {it:filename2} or {it:filename} is specified without an extension,
{opt .raw} is assumed.
{p_end}
{p 4 6 2}
In the first syntax, if {cmd:using} {it:filename2} is not specified on the
command line and {cmd:using} {it:filename} is not specified in the dictionary,
the data are assumed to begin on the line following the closing brace.
{p_end}
{p 4 6 2}
Note that if your {it:dfilename} or {it:filename2} contains embedded spaces,
remember to enclose it in double quotes. {p_end}
{title:Description}
{pstd}
{opt infix} reads into memory from a disk dataset that is not in Stata format.
{opt infix} requires that the data be in fixed-column format.
{pstd}
{opt infile} and {opt insheet} are alternatives to {opt infix}. {opt infile}
can also read data in fixed-format{hline 2}see {help infile2}{hline 2}and it
can read data in free format{hline 2}see {help infile1}.. Most people think
{opt infix} is easier to use for reading fixed-format data, but {opt infile}
has more features. If your data are not fixed-format, you can use
{opt insheet}; see {helpb insheet}. If you are not certain that {opt infix}
will do what you are looking for, see {help infiling} and
{bind:{bf:[U] 21 Inputting data}}.
{pstd}
In its first syntax, {opt infix} reads the data in a two-step process. You
first create a disk file describing how the data are recorded. You tell
{opt infix} to read that file{hline 2}called a dictionary{hline 2}and from
there, {opt infix} reads the data. The data can be in the same file as the
dictionary or in a different file.
{pstd}
In its second syntax, you tell {opt infix} how to read the data right on the
command line with no intermediate file.
{title:Options}
{dlgtab:Main}
{phang}
{opt using(filename2)} specifies the name of a file
containing the data. If {opt using()} is not specified, the data are assumed
to follow the dictionary in {it:dfilename}, or, if the dictionary specifies the
name of some other file, that file is assumed to contain the data. If
{opt using(filename2)} is specified, {it:filename2} is used to
obtain the data, even if the dictionary says otherwise.
{phang}{opt clear} specifies that it is okay for the new data to replace what
is currently in memory. To ensure that you do not lose something important,
{opt infix} will refuse to read new data if data are already in memory.
{opt clear} allows {opt infix} to replace the data in memory. You can also
drop the data yourself by typing {cmd:drop _all} before reading new data.
{title:Examples of first syntax}
{phang2}{cmd:. infix rate 1-4 speed 6-7 acc 9-11 using highway.raw}{p_end}
{phang2}{cmd:. infix rate 1-4 speed 6-7 acc 9-11 using highway.raw if rate>2}{p_end}
{phang2}{cmd:. infix rate 1-4 speed 6-7 acc 9-11 using highway.raw in 1/100}
{title:Examples of second syntax}
{phang2}{cmd:. infix using highway.dct}{p_end}
{phang2}{cmd:. infix using highway.dct if rate>2}{p_end}
{phang2}{cmd:. infix using highway.dct in 1/100}
{pstd}
where {hi:highway.dct} contains
{hline 13} top of highway.dct {hline 3}
{cmd:infix dictionary using highway.raw {c -(}}
{cmd:rate 1-4}
{cmd:speed 6-7}
{cmd:acc 9-11}
{cmd:{c )-}}
{hline 13} end of highway.dct {hline 3}
{title:Example reading string variables and multiple lines}
{phang2}{cmd:. infix 2 lines 1: id 1-6 str name 7-36 2: age 1-2 sex 4 using emp.raw}{p_end}
or
{phang2}{cmd:. infix using emp.dct}
{pstd}
where {bf:emp.dct} contains
{hline 13} top of emp.dct {hline 3}
{cmd:infix dictionary using emp.raw {c -(}}
{cmd:2 lines}
{cmd:1:}
{cmd:id 1-6}
{cmd:str name 7-36}
{cmd:2:}
{cmd:age 1-2}
{cmd:sex 4}
{cmd:{c )-}}
{hline 13} end of emp.dct {hline 3}
{title:Also see}
{psee}
Manual: {bf:[D] infix (fixed format)}
{psee}
Online: {help infile2},
{helpb insheet},
{helpb outfile},
{helpb outsheet},
{helpb save}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -