Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Using the ASCII Code Character Map
From
Jeph Herrin <[email protected]>
To
[email protected]
Subject
Re: st: Using the ASCII Code Character Map
Date
Tue, 18 Mar 2014 09:28:04 -0400
In adition, for reusing local macros see
http://www.stata-journal.com/sjpdf.html?articlenum=pr0047
cheers,
J
On 3/17/2014 11:11 AM, Nick Cox wrote:
Your do-file defines locals in its own space. While the do-file
executes, they are invisible elsewhere. As soon as the do-files
terminates, they are gone.
There are ways round this, but the simplest for you is that you can
and should use globals instead
local Chh=char(200)
becomes
global Chh = char(200)
replace country="Slova${Chh}ka" in 8
You should also be able to do this.
replace country="Slova`=char(200)'ka" in 8
or this
replace country="Slova" + char(200) + "ka" in 8
Nick
[email protected]
On 17 March 2014 14:58, Bruno Skrinjaric <[email protected]> wrote:
Dear all,
When I want to insert some characters from ASCII Code Character Map (net describe asciiplot, from (http://fmwww.bc.edu/RePEc/bocode/a/)) I use the following command:
u "$path\grey_eco.dta", clear
local Chh=char(200)
local chh=char(232)
local Ch=char(198)
local ch=char(230)
local D=char(208)
local d=char(240)
local Sh=char(138)
local sh=char(154)
local Z=char(142)
local z=char(158)
replace country="`Chh'e`sh'ka" in 1
replace country="Ma`d'arska" in 6
replace country="Slova`chh'ka" in 8
Since I am from Croatia these are all letters in Croatian alphabet. I defined as local all the letters not found in English language that I might ever need (I did not have to write them all out here but I did that to illustrate my question). I have two questions about that?
First, is it possible to define a GLOBAL instead of a local for these characters, and how to use this if it is possible?
Second, I have tried saving all these locals in separate .do file and then loading it into working memory prior to -replace- command, but that didn't work. Here is what I have tired:
u "$path\grey_eco.dta", clear
do "$path\ascii_code_characters.do"
replace country="`Chh'e`sh'ka" in 1
replace country="Ma`d'arska" in 6
replace country="Slova`chh'ka" in 8
So, basically, my question is - is there any way of making a "permanent" list of the ASCII characters I will be using regularly and then just "calling" to that list when I need it?
Just to be clear, the first code in this e-mail works fine, I am just wondering is there a way where I do not have to write the local every time?
Bruno Škrinjarić
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/