Difference between revisions of "User:Kbjarkefur"
Kbjarkefur (talk | contribs) |
Kbjarkefur (talk | contribs) |
||
Line 17: | Line 17: | ||
'''Ex.1''' Use the ''egen'' function <code>rowtotal()</code> when aggregating variables. | '''Ex.1''' Use the ''egen'' function <code>rowtotal()</code> when aggregating variables. | ||
However, the <nowiki> <code></nowiki> tag is not great when writing multiple lines of code because there is a space in the formatting between the lines. | However, the <nowiki><code></nowiki> tag is not great when writing multiple lines of code because there is a space in the formatting between the lines. It doesn't feel like a single code snippet. | ||
'''Ex.2''' | '''Ex.2''' | ||
Line 26: | Line 26: | ||
replace varA = 0 if gender == 0 | replace varA = 0 if gender == 0 | ||
</code> | </code> | ||
One solution to this that I found was to use the <nowiki><pre></nowiki> tag. Multiple lines displays really nice (and I like the color better): | |||
<pre> | |||
gen varA = . | |||
replace varA = 1 if gender == 1 | |||
replace varA = 0 if gender == 0 | |||
</pre> |
Revision as of 21:14, 26 October 2017
About me
- Kristoffer Bjärkefur
- Work with developing best practice and software tools at DIME
- See https://github.com/worldbank/ietoolkit
- kbjarkefur@worldbank.org
Pages on this wiki I frequently need:
- Stylesheet : MediaWiki:Common.css
- Javascript : MediaWiki:Common.js
Code snippet example
This part is using the regular <code> tag which is great when writing code in the middle of a sentence:
Ex.1 Use the egen function rowtotal()
when aggregating variables.
However, the <code> tag is not great when writing multiple lines of code because there is a space in the formatting between the lines. It doesn't feel like a single code snippet.
Ex.2
gen varA = .
replace varA = 1 if gender == 1
replace varA = 0 if gender == 0
One solution to this that I found was to use the <pre> tag. Multiple lines displays really nice (and I like the color better):
gen varA = . replace varA = 1 if gender == 1 replace varA = 0 if gender == 0