Econometrics blog

Aug 19, 2016

Install Latex Package on Sublime 3

To use latex in Sublime, we need to install Latex tools on Sublime 3. Here is the instruction to install LaTeXTools. 
https://packagecontrol.io/packages/LaTeXTools
First, you have to install Sublime and Sumatra PDF

Before we need to install LaTexTools, we have to install the package control from here.
https://packagecontrol.io/installation


After installing package control. Open Sublime and click Shift+Ctrl+P to open the Palette. Search for "install package"and look for "LaTeXtools".

If succeeded, you will see latex on the build.

Apr 21, 2016

Converting a Polygon ZM shape file to a regular Shape Polygon

from:http://blog.csdn.net/qb371/article/details/8102109

I tried this on Arcmap 10.4:

  • Locate the following tool - 
    • ArcToolbox > Conversion Tools > To Shapefile > Feature Class To Shapefile (multiple) 
  • Launch the tool and add your Polygon ZM shapefiles to the input features. 
  • Select an 'Output Folder' 
  • Click on the 'Environments...' button at the bottom of the dialog box. To the right of the 'OK' button. 
  • Click on the 'General Settings' text. 
  • You should see two fields marked 'Output has Z Values' and 'Output has M Values'. 
  • Set both fields to 'Disabled'. 
  • Click 'OK' to exit the Environments Settings then click 'OK' to run the tools.

Feb 16, 2016

Remove trailing space in excel

Using the Trim function is easy to remove the trailing space in one cell, but time-consuming to remove trailing spaces in many cells. Here provides a macro to remove all trailing spaces of all cells in a selection.
Step 1: Select the range in which you want to remove trailing spaces from cells.
Step 2: Hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window.
Step 3: Click Insert > Module, and paste the following macro in the Module Window.
Sub NoSpaces()
Dim c As Range
For Each c In Selection.Cells
c = Trim(c)
Next
End Sub
Step 4: Press the F5 key to run this macro. And all of the trailing spaces of the selection will be removed.

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:
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