[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: simple data input question- expanding macros

From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: RE: simple data input question- expanding macros
Date   Fri, 15 Aug 2008 10:54:54 +0200

This raises questions on several levels. If the -local- does not do the job,
the -global- probably won`t fix that. Omit the equal sign which is
unnecessary. See the following for an example of what happens:

local color  "red"
cap di `color'
di _rc
di "`color'"

On another level, why do you not paste the strings into the data editor?
Your approach to entering data seems unusual and horribly complicated...


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
[email protected]
Sent: Friday, August 15, 2008 10:35 AM
To: [email protected]
Subject: st: simple data input question- expanding macros

Hi, I apologize for such a simple question. I hope to eventually participate
in statalist on a much higher level.

I would like to input data that I have in strings manually in a .do file.
That is, say I have a for loop going through a list of a bunch of strings,
how can I use those strings to input data?

Say, I have a macro called color.
and, I have an existing dataset with blue and green as observations (there
is only one variable, COL).
Why doesn't the following work:

local color = "red"

I tried the above code using a global variable as well, to no avail:

global color = "red"

Is there a better way to do this? How do I expand my macro before anything
else happens?

Thank you!

PS. is there any good forum online that might be better for beginner
Get Windows Live and get whatever you need, wherever you are.  Start here.
*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index