📄 usersite.hlp
字号:
{smcl}
{* 23dec2004}{...}
{cmd:help usersite}
{hline}
{title:Title}
{p2colset 5 16 18 2}{...}
{p2col :{hi:[R] net} {hline 2}}Install and manage user-written additions from the net{p_end}
{p2colreset}{...}
{title:Creating your own site}
{pstd}
Below we provide instructions on how to create your own site to distribute
do-files, ado-files, help files, datasets, ... that other users can fetch
using the {helpb net} command. Also see {bind:{bf:[R] net}} for examples.
{title:Remarks}
{pstd}
Remarks are presented under the headings
{hi:{help usersite##intro:Introduction}}
{hi:{help usersite##remarks1:1. Place the files on your homepage}}
{hi:{help usersite##remarks2:2. Make a site}}
{hi:{help usersite##remarks3:3. Make a package}}
{hi:{help usersite##remarks4:4. Improve your site}}
{hi:{help usersite##remarks5:Types of files you can deliver}}
{hi:{help usersite##remarks6:The full details of package files}}
{hi:{help usersite##remarks7:The full details of content files}}
{hi:{help usersite##remarks8:SMCL in content and package-description files}}
{hi:{help usersite##remarks9:Error-free file delivery}}
{marker intro}{...}
{title:Introduction}
{pstd}
If you have not tried {cmd:net}, do that first. From the command line, type
{cmd:. net}
{pstd}
or pull down {hi:Help} and choose {hi:SJ and User-written Programs}.
{pstd}
Additions to Stata are available from Stata and from other users. This
help file provides the information necessary for constructing a site to
provide additions to Stata.
{pstd}
To do this, you must have access to a homepage on the World Wide Web.
Let's pretend that your home page is {hi:http://www.zzz.edu/users/~me}, and
you wish to make the following files available:
myprog.ado
myprog.hlp
mydata.dta
{pstd}
Basically, you can place these files in the directory containing your home
page, and Stata can access them. By adding a few more files, you can make
accessing them easier. The files do not interfere with the normal operation
of HTML pages.
{marker remarks1}{...}
{title:1. Place the files on your homepage}
{pstd}
Copy the files to the directory containing your home page. After that,
users all over the world can access them from inside Stata by simply typing
{cmd:. copy http://www.zzz.edu/users/~me/myprog.ado myprog.ado}
{cmd:. copy http://www.zzz.edu/users/~me/myprog.hlp myprog.hlp}
{cmd:. copy http://www.zzz.edu/users/~me/mydata.dta mydata.dta}
{pstd}
Users would still need to "install" (copy) {cmd:myprog.ado} and
{cmd:myprog.hlp} to the appropriate place.
{pstd}
The dataset would, of course, be ready to use. Actually, the dataset need
not even be copied down by users; they could use it directly by typing
{cmd:. use http://www.zzz.edu/users/~me/mydata.dta, clear}
{marker remarks2}{...}
{title:2. Make a site}
{pstd}
Stata's {cmd:net} command and corresponding pulldown is the way users want
to fetch your materials. Right now, that will not work with your site:
{cmd:. net from http://www.zzz.edu/users/~me}
{err}file from http://www.zzz.edu/users/~me not found
http://www.zzz.edu/users/~me/ either
1) is not a valid URL, or
2) could not be contacted, or
3) is not a Stata download site (has no stata.toc file).{txt}
{search r(601):r(601);}
{pstd}
To make a download site, create another new file, {cmd:stata.toc}, on your
home page.
{pstd}
If you leave {cmd:stata.toc} empty, the following will happen when someone
links to your site:
{cmd:. net from http://www.zzz.edu/users/~me}
{hline 60}
http://www.zzz.edu/users/~me
{hi:(no title)}
{hline 60}
{p 8 8 12}This site provides additions and other materials for use with Stata
but provides no table of contents. No doubt you have a memo from
somebody telling you what you can {hi:net install} and {hi:net get}.
{p_end}
{hline 60}
{pstd}
It is the presence of this file that tells Stata that your URL provides
Stata materials as well as HTML pages.
{pstd}
We will discuss making a pretty site shortly.
{marker remarks3}{...}
{title:3. Make a package}
{pstd}
A package is a collection of files; the files
myprog.ado
myprog.hlp
mydata.dta
{pstd}
form a package. A package file lists the files in a package. Package files
end in the suffix {cmd:.pkg}. If you created {cmd:myprog.pkg} describing the
above three files, users could type
{cmd:. net from http://www.zzz.edu/users/~me/}
<output omitted>
{cmd:. net describe myprog}
{hline 60}
package {hi:myprog} from http://www.zzz.edu/users/~me
{hline 60}
{hi:TITLE}
myprog. Package to analyze data.
{hi:DESCRIPTION/AUTHORS}
Program by me.
Other lines describing the package could appear here.
{hi:INSTALLATION FILES} (type {hi:net install myprog})
myprog.ado
myprog.hlp
{hi:ANCILLARY FILES} (type {hi:net get myprog})
mydata.dta
{hline 60}
{pstd}
and, if they wanted to install your package, they could type
{cmd:. net install myprog}
{pstd}
The package file that would cause all this to happen is
{hline 3} BEGIN {hline 3} myprog.pkg {hline 35}
{cmd:v 3}
{cmd:d myprog. Package to analyze data.}
{cmd:d Program by me.}
{cmd:d Other lines describing the package could appear here.}
{cmd:* I can also insert comments; these will not be displayed.}
{cmd:* f lines name the files that comprise your package:}
{cmd:f myprog.ado}
{cmd:f myprog.hlp}
{cmd:f mydata.dta}
{hline 3} END {hline 5} myprog.pkg {hline 35}
{pstd}
This file does not look like much, but looks pretty when the user asks
Stata about it.
{marker remarks4}{...}
{title:4. Improve your site}
{pstd}
The problem now is that nobody knows to type "{cmd:net install myprog}"
unless you tell them. Go back and change your {cmd:stata.toc} file:
{hline 3} BEGIN {hline 3} stata.toc {hline 36}
{cmd:v 3}
{cmd:d Materials by me}
{cmd:d Here are some useful things I have written}
{cmd:p myprog A program to analyze data}
{hline 3} END {hline 5} stata.toc {hline 36}
{pstd}
Now when users type,
{cmd:. net from http://www.zzz.edu/users/~me/}
{hline 60}
http://www.zzz.edu/users/~me/
{hi:Materials by me}
{hline 60}
Here are some useful things I have written
PACKAGES you could -{hi:net describe}-
{hi:myprog} A program to analyze data
{hline 60}
{pstd}
they will see what you have to offer.
{marker remarks5}{...}
{title:Types of files you can deliver}
{pstd}
Most packages contain ado-files and help files and, sometimes, a dataset that
is used for demonstration purposes. By default, the ado-files and help files
are installed and the data file is made available to the user should he or she
wish to load it.
{pstd}
Stata determines whether a file is installable or is instead simply ancillary
based on its suffix. The following filetypes are automatically installed:
file suffix{col 30}description
{hline 62}
{cmd:.ado}{...}
{col 30}executable code
{cmd:.class}{...}
{col 30}executable code
{cmd:.hlp}{...}
{col 30}explanation to be displayed by {cmd:help}
{cmd:.key}{...}
{col 30}keyword information to be used by {cmd:search}
{cmd:.mnu}{...}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -