LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2007, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sun, 21 Jan 2007 00:25:43 +0000
Reply-To:     toby dunn <tobydunn@HOTMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         toby dunn <tobydunn@HOTMAIL.COM>
Subject:      Re: Novice question: rename variables in sas7bdat file
Comments: To: zhongming@GMAIL.COM
In-Reply-To:  <1169337774.388267.95610@11g2000cwr.googlegroups.com>
Content-Type: text/plain; format=flowed

Data One ; _111_ = 1 ; _112_ = 2 ; _113_ = 'A' ; _114_ = 'B' ; ; Run ;

Proc SQL ; Select Name || ' = ' || Cats( 'Var' , VarNum ) Into : NewNames Separated by ' ' From Dictionary.Columns Where LibName = 'WORK' And MemName = 'ONE' ; Quit ;

Proc Datasets Lib = Work ; Modify One ; Rename &NewNames ; Run ; Quit ;

Proc Contents Data = One ; run ;

Toby Dunn

To sensible men, every day is a day of reckoning. ~John W. Gardner

The important thing is this: To be able at any moment to sacrifice that which we are for what we could become. ~Charles DuBois

Don't get your knickers in a knot. Nothing is solved and it just makes you walk funny. ~Kathryn Carpenter

From: Seeker <zhongming@GMAIL.COM> Reply-To: Seeker <zhongming@GMAIL.COM> To: SAS-L@LISTSERV.UGA.EDU Subject: Novice question: rename variables in sas7bdat file Date: Sat, 20 Jan 2007 16:02:54 -0800

Hi, there

I have a sas7bdat file (doh.sas7bdat) with 500 variables in it. The issue is that the names of the variables are irregular, like "_347_", "_3554_", etc. Is there a easy way to rename these variables as a regular set ("v1"-"v500")

libname data 'C:\data\'; data NEW; set data.doh; RUN;

_347_ _3554_ _205_ XXXX XXXX XXXX

If the file format is not sas7bdat, I can use "INPUT v1-v500;" after INFILE statement to achieve this. However, I can not figure out how to import sas7bdat file using INFILE.

Thanks for your help!

Ming

_________________________________________________________________ Laugh, share and connect with Windows Live Messenger http://clk.atdmt.com/MSN/go/msnnkwme0020000001msn/direct/01/?href=http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=hmtagline


Back to: Top of message | Previous page | Main SAS-L page