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 (October 2008, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 28 Oct 2008 09:22:10 -0400
Reply-To:     Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Subject:      Re: Calculating a New Variable based on existing variables in a
              SAS Datafile

Use a array for that:

.... array x(*) lag1-lag100; new_var=1; do i=1 to dim(x) while (new_var=1); if x(i) ne 1 then new_var=0; end; ...

something like that should do it. Gerhard

n Tue, 28 Oct 2008 05:14:15 -0700, Akshaya <akshaya.nathilvar@GMAIL.COM> wrote:

>Hi all, > >I have a SAS datafile with 100 variables, lag1-lag100. I have to >calculate a new variable and assign a value of 1, if the value of all >100 variables is 1; else 0. Is there a simpler way, instead of using >"IF lag1=1 and lag2=1 and lag3=1 and.... lag100=1". Thanks for any >suggestions. > >Thanks! >Akshaya

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