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 2010, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 29 Jan 2010 11:23:16 -0800
Reply-To:     "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Subject:      Re: Simple Sequence in SAS
Comments: To: saslearn chicago <sasswamy@GMAIL.COM>
In-Reply-To:  A<4daddd151001291114q26af9b1dgf770c6f8cb9c8c1@mail.gmail.com>
Content-Type: text/plain; charset="us-ascii"

Hi Swamy,

Here are a couple of ways:

data sample; input week freq total; cards; 20 3 3 21 4 7 25 2 9 ; run;

* method #1 ; data result1; set sample; D = _N_; run;

* method #2 ; data result2; set sample; retain D 0; D+1; run;

* method #3 ; data result3; set sample; retain D 0; D=D+1; run;

Hope this is helpful.

Mark Terjeson Investment Business Intelligence Investment Management & Research Russell Investments 253-439-2367

Russell Global Leaders in Multi-Manager Investing

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of saslearn chicago Sent: Friday, January 29, 2010 11:15 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Simple Sequence in SAS

All,

Can someone tell me the easiest way to Increment a variable in SAS say I have 3 field , week , freq . total in a table

week freq total D 20 3 3 1 21 4 7 2 25 2 9 3..

I wanted a new field 'D' with starting value 1 , goes on till the last row increment by 1

Thanks, - swamy


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