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]
st: AW: Writing a value from a variable into a macro
From
"Martin Weiss" <[email protected]>
To
<[email protected]>
Subject
st: AW: Writing a value from a variable into a macro
Date
Fri, 24 Sep 2010 15:24:37 +0200
<>
The point, Stefan, is that -local- does not accept the -if- qualifier, which
is admittedly rare for Stata commands. Look at its help file -help macro- to
see that.
This FAQ may also be helpful:
http://www.stata.com/support/faqs/data/setobsequal.html
HTH
Martin
-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Palan, Stefan
([email protected])
Gesendet: Freitag, 24. September 2010 14:31
An: [email protected]
Betreff: st: Writing a value from a variable into a macro
Hi everybody,
I would like to write a specific value of a variable in my dataset into a
macro. Assume I have a dataset with the two variables "number" and "text".
They contain observations like (1, "one"), (2, "two"), (3, "three"), etc.
Now I would like to write a specific value into a local macro. For example,
I might be looking for the text that goes with the observation with
number==2, and would like to assign that value to a local macro. Very
amateurishly, I was looking for code similar to the following:
local v=text if number==2
Unfortunately, that doesn't work. Can somebody help me with some code that
would actually work?
Cheers,
Stefan.
---
Dr. Stefan Palan
Assistant Professor
Karl-Franzens-University Graz
Institute of Banking and Finance
Universitaetsstrasse 15/F2
8010 Graz, Austria/EU
Tel.: +43 (0) 316 / 380 7306
Fax.: +43 (0) 316 / 380 9580
[email protected]
http://www.palan.biz/academic
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/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/statalist/faq
* http://www.ats.ucla.edu/stat/stata/