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 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 26 Jan 2007 07:56:25 -0500
Reply-To:     Ed Heaton <EdHeaton@WESTAT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ed Heaton <EdHeaton@WESTAT.COM>
Subject:      Re: input of variable length variables
Comments: To: Arthur Tabachneck <art297@NETSCAPE.NET>, allhunt@SIUE.EDU
In-Reply-To:  <200701260204.l0PN0ROm016559@mailgw.cc.uga.edu>
Content-Type: text/plain; charset="us-ascii"

Allen and Arthur,

Why don't you just do this reordering in the original DATA step?

data have; format firstname $30. lastname $30. email $30. nickname $30. ; infile cards scanover; input lastname $ firstname $ nickname $ email $; cards; Washington George gwashi gwashi@some.place Hill Thomas thill thill@some.place Vaughn Vera vaughn vvaughn@some.place ; /* run; The DATA step ends with the semicolon above. There's nothing to run here! */

Ed

Edward Heaton, Senior Systems Analyst, Westat (An Employee-Owned Research Corporation), 1600 Research Boulevard, RW-4541, Rockville, MD 20850-3195 Voice: (301) 610-4818 Fax: (301) 294-3879 mailto:EdHeaton@Westat.com http://www.Westat.com

-----Original Message----- From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu] On Behalf Of Arthur Tabachneck Sent: Thursday, January 25, 2007 9:04 PM To: SAS-L@LISTSERV.UGA.EDU; allhunt@SIUE.EDU Subject: Re: input of variable length variables

I just realized that I didn't answer both parts of your question. Once you have the data, simply use a retain statement indicating the desired order. For example:

data have; format lastname $30. firstname $30. nickname $30. email $30.; infile cards scanover; input lastname $ firstname $ nickname $ email $; cards; Washington George gwashi gwashi@some.place Hill Thomas thill thill@some.place Vaughn Vera vaughn vvaughn@some.place ; run;

data want; retain firstname lastname email nickname; set have; run;

HTH, Art -------- On Thu, 25 Jan 2007 14:00:53 -0800, Allen <allhunt@SIUE.EDU> wrote:

>I forgot to say, but I am trying to input this data like cards. Again >Thanks! -Allen > >On Jan 25, 3:57 pm, "Allen" <allh...@siue.edu> wrote: >> I have to cut and past data fields out of another program and I need to >> reorder the variables and generally be able to manipulate the data as >> ususal in a dataset. After manipulation, I'll want to export the data. >> The dataset has 4 variables each of varying length. I have an example >> below. Thanks for your help! -Allen >> >> Washington George gwashi gwa...@some.place >> Hill Thomas thill t...@some.place >> Vaughn Vera vaughn vvau...@some.place


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