woensdag 29 november 2017

Stata command labelmerge to label values from an Excel file

Download the code here:
https://drive.google.com/open?id=0B3AYa3V7lxmoeXhlR2dIT0lNV00

Syntax

labelmerge varname using excelfile.xlsx [, nomerge nolabel]

Your excelfile has one column varname, and the other varnamelabel. Varname could be nace, for instance, and your file could be called nacerev2english.xlsx.

The code adds the label to the values of varname. If you want to disable this, use the option nolabel.
The code also adds the label as a string. If you want to disable this (and gain some speed and space), use the option nomerge.

Don't forget you need -labmask-. Install this first from SSC.

It's as simple as that.

Cheers




From the ado:
___________________

Labelmerge
___________________


The program does two things:
1) it adds a variable that holds the label as a string
2) it assigns the values of that string as variable labels

You can decide to not maintain either of both, but not both as that would be
senseless.


TO DO
-----
1- Perhaps it could be handy to have the option to select a label from different
options (e.g. languages) in the dataset.

2- Maybe trimming some labels is needed if -labmask- doesn't do it already.


HOW SHOULD YOUR LABELFILE LOOK LIKE
-----------------------------------
It should have just two columns:
a) the numeric variable itself, labeled in the main file exactly the same
b) the value labels as a string variable which is labeled as the main variable
with suffix 'label'

The filename of the matrix could be anything, this is to be specified.


WHY IS THIS PROGRAM USEFUL?
---------------------------
Because you can use label files easily between different syntaxes and projects.
It is better than 'label save' which creates do files, because you have the
labels nicely adjustable in a matrix.


INSTALLATION INSTRUCTIONS
-------------------------

You need to have -labmask- installed.

To install: put the contents in the folder

`c(sysdir_personal)'/m/

for example, in Windows this is generally:

c:\ado\personal\m\

- OR -

Install the file through adopath + "folder"
Like this:

adopath + "c:\random_ado_folder\"


donderdag 9 november 2017

Running Python on Mac

Most rookie guides are still to complex for a fairly easy install.

macOS has Python 2.7 pre-installed, you don't need Python 3.X (yet).

Additionally, install (in order):
  • Xcode (including command line tools)
  • Homebrew (a package manager)
  • Sublime Text (or TextWrangler)
Writing the syntax in Sublime Text, you need to select the build system (python), and build (=run) the code. The output is giving in the console. Code is straightforward, but graphic capabilities are poor.

Source: https://www.macworld.co.uk/how-to/mac/coding-with-python-on-mac-3635912/