Skip to content

Instantly share code, notes, and snippets.

View hargi12's full-sized avatar

Haron Gichuhi hargi12

View GitHub Profile

How to write programs (also called commands or functions) in Stata

This is an introduction to how to write programs in Stata. To try this out yourself, download this Gist by clicking Download Zip. Unpack the .zip file and edit the path global in the runfile.do. Then follow these instructions and run the corresponding section of the run file.

If you have any questions or want us to add another examples on how you can expand myhist.ado as us in the comment section below.

Hello World

It is common in computer science that the first function/command you write is a simple command that just display the message Hello World!. That is what the program in hello_world.ado does.

@hargi12
hargi12 / palindrome.py
Last active October 1, 2018 09:43
A simple python script to check if a string is palindrome or not
# Program to check if a string
# is palindrome or not
# A palindrome is a word that reads the same backward and forward ie same number of characters, and meaning!
# change this value for a different output
my_str = 'aIbohPhoBiA'
# make it suitable for caseless comparison
my_str = my_str.casefold()