Bookmark and Share

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: RE: Placing a string variable in a local/global


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: RE: Placing a string variable in a local/global
Date   Tue, 27 Apr 2010 22:20:43 +0200

<>


You want your qualifier to be

*************
if X  =="`n'"
*************


HTH
Martin


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of George Chioran
Sent: Dienstag, 27. April 2010 22:15
To: [email protected]
Subject: st: Placing a string variable in a local/global

Dear Statalisters, 

I am assigning the names of certain observations from variable X to a
local/global with the command: local n = X[_N]. Say that now `n' has the
string "bear" stored in it.
Next I load a larger data base where variable X has several string
observations named bear among others.
For the final step I am trying to record the observations from variable Z
where `n' = X in a variable y. My code is this: 

local n = X[_N]
use "C:\Users\George\Desktop\Methodology\Final data1.dta", clear
gen y = Z if `n' == X

However when I do this, I get the error message: unrecognized command:  bear

Do you know how I could store observations from X so that when I load a
larger data set I can use them to see how many similar observations I have
in the larger data set? 


Thank you a lot for the help, 
George


      
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index