[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Incorporating variable labels into the variable name

From   "Rodriguez, Dan" <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: Incorporating variable labels into the variable name
Date   Fri, 7 Sep 2007 16:41:27 -0400

Title: Incorporating variable labels into the variable name

I have a comma-delimited datafile that I need to process on a daily basis within Stata where I need to convert the labels for about 200 columns into variable names. The file looks like the following:

acct    name    9/5/2007        9/4/2007        8/31/2007      
84J     Jacky   1       2       -1     
B88     Mike    -2      3       -1     
B93     Mike    4       5       2      

When I import this file into Stata I get:

acct            name    v18     v19     v20
84J             Jacky   1       2       -1
B88             Mike    0       0       0
B93             Mike    0       0       0

. desc

Contains data
  obs:         1,495                         
 vars:           190                         
 size:     1,728,220 (83.5% of memory free)
              storage  display     value
variable name   type   format      label      variable label
acct            str8   %9s                    Trading Acct
name            str53  %53s                   Trader
v18             float  %9.0g                  9/5/2007
v19             float  %9.0g                  9/4/2007
v20             float  %9.0g                  8/31/2007
v21             float  %9.0g                  8/30/2007
v22             float  %9.0g                  8/29/2007
v23             float  %9.0g                  8/28/2007
v24             float  %9.0g                  8/27/2007
v25             float  %9.0g                  8/24/2007
v26             float  %9.0g                  8/23/2007
v27             float  %9.0g                  8/22/2007
v28             float  %9.0g                  8/21/2007
v29             float  %9.0g                  8/20/2007

How can I change the variable names to rev_Sep5_2007, rev_Sep4_2007, rev_Aug31_2007, etc.?

I need to apply a reshape command to facilitate further analysis.

Thank you,
Dan Rodriguez

Please access the attached hyperlink for an important electronic communications disclaimer:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index