Dec 30, 2015
Generating with matching value
This is how to generate a variable with number matching:
#delimit;
egen poten_indo = anymatch(digit4n), values(
7201 7207 7113 8419 8003 8311 1804 1703 2902 6114 0906 3906 7305 4401 7208 6111 6406 5503 1605 0802 1212 8007 8538 7407 5205 0801
);
#delimit cr
Jan 13, 2015
Cubic spline interpolation
We can interpolate missing data by using cubic spline in stata
first, install this package in stata:
this is an example:
first, install this package in stata:
ssc install csipolate
this is an example:
Setup
. webuse ipolxmpl1
List the data
. list, sep(0)
Create y1 containing a natural cubic spline interpolation of y on
x for missing values of y
. csipolate y x, gen(y1)
List the result
. list, sep(0)
Nov 4, 2014
leading zero in string variable
A typical example might be to convert the following numbers
> to a standard five-digit number with leading zeros:
> 2 --> 00002
> 33 --> 00033
> 473 --> 00473
> 59724 --> 59724
Display with leading zeros is a matter of format:
di %05.0f 2
A more fundamental change is:
gen str5 newvar = string(oldvar,"%05.0f")
Oct 26, 2014
create label value from variable in stata
buat label value dari country, dari kode negara
we can use command labmask
. labmask kdnn, value(country)
. tabdis kdn, cellvar(kdnn country)
--------------------------------------------------
kdn | kdnn country
----------+---------------------------------------
001 | FRANCE FRANCE
003 | NETHERLANDS NETHERLANDS
004 | GERMANY GERMANY
006 | UTD. KINGDOM UTD. KINGDOM
007 | IRELAND IRELAND
008 | DENMARK DENMARK
we can use command labmask
. labmask kdnn, value(country)
. tabdis kdn, cellvar(kdnn country)
--------------------------------------------------
kdn | kdnn country
----------+---------------------------------------
001 | FRANCE FRANCE
003 | NETHERLANDS NETHERLANDS
004 | GERMANY GERMANY
006 | UTD. KINGDOM UTD. KINGDOM
007 | IRELAND IRELAND
008 | DENMARK DENMARK
Sep 29, 2014
LaTeX: Change subsection numbering
If you want to change the subsection numbering, you have to renew the command first as follows:
\renewcommand\thesection{\roman{section}}
\renewcommand\thesubsection{\thesection.\roman{subsection}}
with similar commands like\thesubsubsectionand so on
of course, there's alsoCommands to typeset numbers include:\thechapter(in thebookandreportclass) and\thepart.
\arabic(1, 2, 3, ...)\alph(a, b, c, ...)\Alph(A, B, C, ...)\roman(i, ii, iii, ...)\Roman(I, II, III, ...)\fnsymbol(∗, †, ‡, §, ¶, ...)
\usepackage{enumerate}
.
.
.
\begin{enumerate}[(a)] % (a), (b), (c), ...
\item
\end{enumerate}
.
.
.
\begin{enumerate}[a)] % a), b), c), ...
\item
\end{enumerate}
Sep 19, 2014
LaTeX: Alligning long equation and manually input equation number
If your equation is too long, you can insert the following comment in the equation environment, with the \\ to break line.
\begin{equation}
\begin{aligned}
..... \\
........
\end{aligned}
\end{equation}
for example:
\begin{equation}\label{e10}
\begin{aligned}
\text{ln VA} = lnQ_3 + 1/ \sigma_y lnMP + lnA + \alpha lnK + (1-\alpha + \varepsilon)\\
\times ln (N-a_0 N^{3/2}) + (1-\rho)/\rho((1+MS)^{-1} ln(N-a_0N^{3/2})).
\end{aligned}
\end{equation}
If you want to manually set equation number just put \tag{equation number} in the end of the equation:
\begin{equation}\label{e10a}
\begin{aligned}
\text{ln VA} = lnQ_3 + 1/ \sigma_y lnMP + lnA + \alpha lnK + (1-\alpha + \varepsilon)\\
\times ln (N-a_0 N^{3/2}) + (1-\rho)/\rho((1+MS)^{-1} ln(N-a_0N^{3/2})).
\end{aligned} \tag{10a}
\end{equation}
LaTeX: Reduce line spacing in enumerate environment
To change enumerate, you must install package enumitem
\usepackage{enumitem}
to change
enumerate globally: \setlist[enumerate]{itemsep=0mm}
to change enumerate locally, \begin{enumerate}[itemsep=3mm]
for example:
\documentclass{article}
\usepackage{lipsum}
\usepackage{enumitem}
\setlist[enumerate]{itemsep=-5mm}
\begin{document}
\lipsum[1]
\begin{enumerate}
\item one
\item two
\end{enumerate}
\lipsum[2]
\begin{enumerate}[itemsep=5mm]
\item one
\item two
\end{enumerate}
\end{document}
Subscribe to:
Posts (Atom)