Date: Mon, 15 Nov 2004 13:34:54 -0500
Reply-To: Fred <firstname.lastname@example.org>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Fred <ieaggie2002@GMAIL.COM>
Subject: How to enumerate all the variable names in a data set?
Content-Type: text/plain; charset=US-ASCII
Give a multivariate data set, for example, with variables
VAR1, VAR2, ..., VARN.
After I imported this data file/set into SAS, how can I
know the number of total variables and their names respectively?
To be specific, if I want to define an array "TotalVariables" such that each
element of it contains the name of a varialbe, i.e.,
TotalVariables(1) = VAR1, TotalVariables(2) = VAR2, etc.
In some later use, I may refer these variables names in other procedures,like
FOR i =1 to N
a = TotalVariables(1) + TotalVarialbes(2),
That is, I do not want to explicitly write down the variable name at
Hope I can understand myself clearly.
Please help me with your point.
Thanks a lot.