Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Placing a string variable in a local/global


From   George Chioran <george_chioran@yahoo.com>
To   statalist@hsphsun2.harvard.edu
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index