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???
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:
create view WORK.reorder as select Nine, Five, Three, Ten from Dataset1
/* Assuming variable in position 9 in PROC CONTENTS has name 'Nine', etc.
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.
From: Saqi [mailto:saqi2000@TOTALISE.CO.UK]
Sent: Monday, January 12, 2004 9:58 AM
Subject: How to swap variables???
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
length for variable 3 is 2 and for variable 9 is 4 and they are poth
Your help would be much appreciated