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 (November 2004, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 15 Nov 2004 13:34:54 -0500
Reply-To:     Fred <ieaggie2002@gmail.com>
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

Hi, all

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), etc.

That is, I do not want to explicitly write down the variable name at each iteration.

Hope I can understand myself clearly. Please help me with your point.

Thanks a lot.

Fred


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