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


From   George Chioran <[email protected]>
To   [email protected]
Subject   st: Placing a string variable in a local/global
Date   Tue, 27 Apr 2010 13:15:23 -0700 (PDT)

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/


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