⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 infile2.hlp

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 HLP
字号:
{smcl}
{* 23feb2005}{...}
{cmd:help infile2}{right:dialog:  {dialog infile_dict:infile (fixed format)}}
{hline}

{title:Title}

{p2colset 5 34 36 2}{...}
{p2col :{hi:[D] infile (fixed format)} {hline 2}}Read ASCII (text) data in
fixed format with a dictionary{p_end}
{p2colreset}{...}


{title:Syntax}

{p 8 15 2}
{opt inf:ile} {helpb using} {it:dfilename} {ifin} [{cmd:,} {it:options}]

{synoptset 19 tabbed}{...}
{synopthdr}
{synoptline}
{syntab :Main}
{synopt :{opt u:sing(filename)}}ASCII dataset filename{p_end}
{synopt :{opt clear}}replace data in memory{p_end}

{syntab :Options}
{synopt :{opt a:utomatic}}create value labels from non-numeric data{p_end}
{synoptline}
{p2colreset}{...}
{p 4 6 2}
If {it:dfilename} is specified without an extension, {cmd:.dct} is assumed.{p_end}
{p 4 6 2}
If {it:filename} is specified without an extension, {cmd:.raw} is assumed.{p_end}
{p 4 6 2}
Note for Stata for Windows and Stata for Macintosh users:  If {it:dfilename}
or {it:filename} contains embedded spaces, remember to enclose it in double
quotes.{p_end}

{phang}
The syntax for a dictionary (a file created with an editor or word
processor outside of Stata) is

	{hline 38} top of dictionary file {hline 3}
	[{cmd:infile}] {cmd:dictionary} [{cmd:using} {it:filename}] {cmd:{c -(}}
		{cmd:* comments may be included freely}
		{cmd:_lrecl(}{it:#}{cmd:)}
		{cmd:_firstlineoffile(}{it:#}{cmd:)}
		{cmd:_lines(}{it:#}{cmd:)}

		{cmd:_line(}{it:#}{cmd:)}
		{cmd:_newline}[{cmd:(}{it:#}{cmd:)}]

		{cmd:_column(}{it:#}{cmd:)}
		{cmd:_skip}[{cmd:(}{it:#}{cmd:)}]

		[{it:type}] {it:varname} [{cmd::}{it:lblname}] [{cmd:%}{it:infmt}] [{cmd:"}{it:variable label}{cmd:"}]
	{cmd:{c )-}}
	{it:(your data might appear here)}
	{hline 38} end of dictionary file {hline 3}

{p 4 6 2}
where {cmd:%infmt} is {c -(} {cmd:%}[{opt #}[{opt .#}]]
{c -(}{opt f}|{opt g}|{opt e}{c )-} | {cmd:%}[{opt #}]{opt s} {c )-}

{p 4 6 2}
If {opt using} {it:filename} is not specified, the data are assumed to begin
on the line following the closing brace.{p_end}
{p 4 6 2}
If {opt using} {it:filename} is specified, the data are assumed to located in
{it:filename}.  If {it:filename} is specified without an extension, {opt .raw}
is assumed.{p_end}


{title:Description}

{pstd}
{opt infile using} reads from a disk a dataset that is not in Stata format.
{opt infile using} does this by first reading {it:dfilename}{hline 2}a
"dictionary" that describes the format of the data file{hline 2}and then reads
the file containing the data.  The dictionary is a file you create in an
editor or word processor outside of Stata.

{pstd}
The data may be in the same file as the dictionary or in another file.

{pstd}
Another variation on {opt infile} omits the intermediate dictionary; see
{help infile1}.  This variation is easier to use but will not read
fixed-format files.  On the other hand, although {opt infile using} will read
free-format files, {opt infile} without a dictionary is even better at it.

{pstd}
An alternative to {opt infile using} for reading fixed-format files is
{opt infix}; see {helpb infix}.  {opt infix} provides fewer features than
{opt infile using} but is easier to use.

{pstd}
Stata has other commands for reading data.  If you are not certain that
{opt infile using} will do what you are looking for, see
{help infiling} and {bind:{bf:[U] 21 Inputting data}}.


{title:Options}

{dlgtab:Main}

{phang}{opt using(filename)} 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(filename)} is
specified, {it:filename} 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 infile using} will
refuse to read new data if other data are already in memory.  {opt clear}
allows {opt infile using} to replace the data in memory.  You can also drop
the data yourself by typing {cmd:drop _all} before reading new data.

{dlgtab:Options}

{phang}{opt automatic} causes Stata to create value labels from the non-numeric
data it reads.
It also automatically widens the display format to fit the longest label.


{title:Examples:  reading data with a dictionary}

{p 4 8 2}{cmd:. infile using mydict}{p_end}
{p 4 8 2}{cmd:. infile using mydict, using(mydata)}{p_end}
{p 4 8 2}{cmd:. infile using mydict if b==1}{p_end}
{p 4 8 2}{cmd:. infile using mydict if uniform()<=.1}


{title:Examples:  sample dictionaries}

    {hline 12} begin file xmpl1.dct {hline 3}
    {cmd:dictionary {c -(}}
	    {cmd:a}
	    {cmd:b}
    {cmd:{c )-}}
    {cmd:1 2}
    {cmd:3 4}
    {hline 21} end of file {hline 3}


    {hline 12} begin file xmpl2.dct {hline 3}
    {cmd:dictionary {c -(}}
	    {cmd:int    t        "day of year"}
	    {cmd:double amt      "amount"}
    {cmd:{c )-}}
    {cmd:1 2.2}
    {cmd:2 3.3}
    {hline 21} end of file {hline 3}


    {hline 12} begin file xmpl3.dct {hline 3}
    {cmd:dictionary {c -(}}
    {cmd:_lines(2)}
    {cmd:_line(1)}
	    {cmd:int   a}
	    {cmd:float b}
    {cmd:_line(2)}
	    {cmd:float c}
    {cmd:{c )-}}
    {cmd:1 2.2}
    {cmd:3.2}
    {cmd:2 3.2}
    {cmd:4.2}
    {hline 21} end of file {hline 3}


    {hline 22} begin file xmpl4.dct {hline 3}
    {cmd:dictionary {c -(}}
	    {cmd:long  idnumb    "Identification number"}
	    {cmd:str6  sex       "Sex"}
	    {cmd:byte  age       "Age"}
    {cmd:{c )-}}
    {cmd:472921002 male 32}
    {cmd:329193100 male 45}
    {cmd:399938271 female 30}
    {cmd:484873982 "female" 33}
    {hline 31} end of file {hline 3}


    {hline 34} begin file xmpl5.dct {hline 3}
    {cmd:dictionary {c -(}}
	    {cmd:_column(5) }
		       {cmd:long  idnumb %9f "Identification number"}
		       {cmd:str6  sex    %6s "Sex"}
		       {cmd:int   age    %2f "Age"}
	    {cmd:_column(27)}
		       {cmd:float income %6f "Income"}
    {cmd:{c )-}}
	{cmd:329193402male  32      42000}
	{cmd:472921002male  32      50000}
	{cmd:329193100male  45}
	{cmd:399938271female30      43000}
	{cmd:484873982female33      48000}
    {hline 43} end of file {hline 3}


{title:Example:  dictionary and data in separate files}

    {hline 32} begin file persons.dct {hline 3}
    {cmd:dictionary using persons.raw {c -(}}
	    {cmd:_column(5) }
		       {cmd:long  idnumb %9f "Identification number"}
		       {cmd:str6  sex    %6s "Sex"}
		       {cmd:int   age    %2f "Age"}
	    {cmd:_column(27)}
		       {cmd:float income %6f "Income"}
    {cmd:{c )-}}
    {hline 43} end of file {hline 3}


    {hline 5} begin file persons.raw {hline 3}
        {cmd:329193402male  32      42000}
        {cmd:472921002male  32      50000}
        {cmd:329193100male  45}
        {cmd:399938271female30      43000}
        {cmd:484873982female33      48000}
    {hline 16} end of file {hline 3}


{title:Also see}

{psee}
Manual:  {bf:[D] infile (fixed format)}

{psee}
Online:  {helpb infix},
{helpb outfile},
{helpb outsheet},
{helpb save}
{p_end}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -