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 2004, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 12 Jan 2004 10:42:32 -0500
Reply-To:     Sigurd Hermansen <HERMANS1@WESTAT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Sigurd Hermansen <HERMANS1@WESTAT.COM>
Subject:      Re: How to swap variables???
Comments: To: Saqi <saqi2000@TOTALISE.CO.UK>
Content-Type: text/plain

Saqi: In the SAS programming environment, one generally refers to column variables in SAS datasets by name, not number. As a rule, one would not refer to a variable as '3' or '9'. The order of columns variables in a display, report, or data extract does not have to be the same as the order in the SAS dataset. The VAR statement in PROC PRINT, for example, allows one to specify the order of column variables in printed reports.

Try a SQL view if you are trying to rearrange the order of column variables in a display of a dataset or assign a series of columns to an indexed array:

proc sql; create view WORK.reorder as select Nine, Five, Three, Ten from Dataset1 /* Assuming variable in position 9 in PROC CONTENTS has name 'Nine', etc. */ ; quit;

The view (virtual dataset) WORK.reorder will sequence the 3rd, 5th, 9th, and 10th columns in the source dataset in the order you have specified. Sig

-----Original Message----- From: Saqi [mailto:saqi2000@TOTALISE.CO.UK] Sent: Monday, January 12, 2004 9:58 AM To: SAS-L@LISTSERV.UGA.EDU Subject: How to swap variables???

Hi Their,

I have got a dataset it had 10 variables. After processing 1st part of it, I have kept 4 variables for 2nd part processing. Variable 3, 5, 9 and 10.

Is it possible to swap variables around I mean 3 and 9. at the moment they are in the follwing order: 3,5,9 and 10 But I would like to swap them 9,5,3 and 10.

length for variable 3 is 2 and for variable 9 is 4 and they are poth character variables.

Your help would be much appreciated


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