Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Eric Booth <eric.a.booth@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: Assign variable labels after importing data from Microsoft Excel |
Date | Mon, 19 Mar 2012 13:43:58 -0500 |
<> ********* clear input str15 (id time var1 var2 var3) label_id label_time label_var1 label_var2 label_var3 1 1960 123 1234 a34 end ** foreach x of varlist * { label var `x' `"`=`x'[1]'"' } drop in 1 foreach x of varlist * { cap destring `x', replace } desc ******** - Eric __ Eric A. Booth Public Policy Research Institute Texas A&M University ebooth@ppri.tamu.edu +979.845.6754 On Mar 19, 2012, at 1:30 PM, Iulian Ihnatov wrote: > Dear Statalisters, > I need to import a Microsoft Excel sheet content (panel data) in Stata 12 that looks as follows: > id time var1 var2 var3 ..... > label_id label_time label_var1 label_var2 label_var3 ... > 1 1960 123 1234 234 > ... > > My problem is to use the values of the second row as value labels for the variable names in the first row. The - import excel - part is the easy one. I looked through the variable label management modules on the SSC archive and could't find an appropriate package to solve my problem. Thus, any help would be highly appreciated. > > -- > Iulian IHNATOV > -------------------------- > Alexandru Ioan Cuza University of Iasi > > * > * 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/