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 at the end of May, and its replacement, statalist.org is already up and running.


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

st: relabeling variables using 2 datasets


From   Smets Lodewijk <Lodewijk.Smets@ua.ac.be>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: relabeling variables using 2 datasets
Date   Fri, 27 Apr 2012 09:41:38 +0000

I want to relabel a large set of variables from one dataset (= DB1) using information from a second dataset (=DB2). 

DB1 contains numeric variables with the following names:  vAG_LND_PRCP_MM ,  vAG_SRF_TOTL_K2 , etc.

DB2 contains a string called seriescodestata which contains as values the same variable names as DB1, i.e. vAG_LND_PRCP_MM ,  vAG_SRF_TOTL_K2 , etc 
 
DB2 also contains another string called indicatorname which contains as values the labels I want to give to the variables in DB1

An example: 

DB1
vAG_LND_PRCP_NM                 vAG_SRF_TOTL_K2       etc.           

    327                             13781730

                                                     
DB2
Seriescodestata                         indicatorname

vAG_LND_PRCP_MM                average precipitation in depth (mm per year)

vAG_SRF_TOTL_K2                   surface area (sq. km)     
 
      etc.


Now I'm looking for a program code to automatically relabel the variables of DB1 using the information in DB2

Thanks!

Lodewijk 






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