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 (May 2006, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 29 May 2006 04:43:47 -0400
Reply-To:     Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Subject:      Re: Creating a variable 'Count'

in a DATA step you have the automatic variable _n_ with a kind of observation counter. This varioable is not stored in the dataset, but you can assign it to a variable which is:

counter = _n_;

On Mon, 29 May 2006 04:11:34 -0400, Ankur Shanker <ankur.shanker@EVALUESERVE.COM> wrote:

>Hi SAS users, > >My request will seem to be pretty simple but bear with me as I have only >recently started using SAS. > >Anyways, i want to create a variable 'count', which will hold the count of >the number of observations in the data set. Say, i have another >variable 'sessionid' and i want to count all those observations >sequentially (in another variable count) until the data reaches the end >i.e. sessionid becomes blank or missing. > >I hope I have made the problem amply clear. > >Thanks and bye > >Ankur Shanker >Business Analyst


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