According to my Stat/Transfer 10 documentation, old illegal variable names are used as variable labels in the output dataset. Therefore, you might type something like:
unab vlist: *
foreach X of var `vlist' {
local Xlab: var lab `X'
cap conf name `Xlab'
if _rc==0 {
rename `X' _`Xlab'
}
}
This should convert illegal variable names from the input text dataset to the same names prefixed with underscores.
I hope this helps.
Best wishes
Roger
Roger B Newson BSc MSc DPhil
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton Campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
UNITED KINGDOM
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: [email protected]
Web page: http://www.imperial.ac.uk/nhli/r.newson/
Departmental Web page:
http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/popgenetics/reph/
Opinions expressed are those of the author, not of the institution.
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Ricardo Ovaldia
Sent: 02 December 2009 15:30
To: [email protected]
Subject: Re: AW: st: Problem with new version of Stat-transfer
Thank you Martin, but that is not exactly correct.
Dropping the prefix will change:
a_2_Reviewer to _2_Reviewer
what I need is _1_2_Reviewer
i.e. the "a"back to "1" and "_" in front.
Ricardo Ovaldia, MS
Statistician
Oklahoma City, OK
--- On Wed, 12/2/09, Martin Weiss <[email protected]> wrote:
> From: Martin Weiss <[email protected]>
> Subject: AW: st: Problem with new version of Stat-transfer
> To: [email protected]
> Date: Wednesday, December 2, 2009, 9:16 AM
>
> <>
>
> " How do I get this behaviour back?"
>
> Just change the prefix within Stata, then:
>
> *************
> clear
> set obs 1
> gen a_1_family=.
> gen a_2_family=.
> //get rid of prefix "a"
> renpfix a
> d
> *************
>
>
>
> HTH
> Martin
>
>
> -----Ursprüngliche Nachricht-----
> Von: [email protected]
> [mailto:[email protected]]
> Im Auftrag von Ricardo Ovaldia
> Gesendet: Mittwoch, 2. Dezember 2009 16:15
> An: [email protected]
> Betreff: Re: st: Problem with new version of Stat-transfer
>
> Eric, Roger and Nick,
>
> Thank you for the Reply. And yes you are correct.
>
> What Stat/transfer did before was to add an underscore
> before the variable
> name. Thus it changed:
>
> 1_1_SubjectID to _1_1_SubjectID
> 1_2_Reviewer to _1_2_Reviewer
> and so on.
>
> How do I get this behaviour back?
>
> Thank you,
> Ricardo Ovaldia, MS
> Statistician
> Oklahoma City, OK
>
>
> --- On Wed, 12/2/09, Eric Booth <[email protected]>
> wrote:
>
> > From: Eric Booth <[email protected]>
> > Subject: Re: st: Problem with new version of
> Stat-transfer
> > To: [email protected]
> > Date: Wednesday, December 2, 2009, 8:57 AM
> > >
> > >
> >
> > You cannot start a Stata variable name with a number,
> > that's why ST changes "1" to "a".
> >
> >
> > __
> > Eric A. Booth
> > Public Policy Research Institute
> > Texas A&M University
> > [email protected]
> > Office: +979.845.6754
> >
> >
> >
> > On Dec 2, 2009, at 8:50 AM, Ricardo Ovaldia wrote:
> >
> > > Dear _all
> > >
> > > I have a Stata program write under Stata's
> version 9
> > that uses stat-transfer's "st.exe" to read an ever
> > increasing number of text data files.
> > >
> > > I recently upgrated to Stat/tranfer 10, and when
> I ran
> > my program it broke.
> > > Stat/transfer rename my variables. For example
> it
> > changed:
> > > 1_1_SubjectID to a_1_SubjectID
> > > 1_2_Reviewer to a_2_Reviewer
> > > and so on.
> > >
> > > How do I get Stat/transfer to respect my
> variable
> > names? and why does it change them?
> > >
> > >
> > > Thank you,
> > > Ricardo Ovaldia, MS
> > > Statistician
> > > Oklahoma City, OK
> > >
> > >
> >
> > *
> > * 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/
>
>
> *
> * 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/
*
* 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/