Date: Wed, 8 Nov 2006 21:23:25 +0000
Reply-To: toby dunn <tobydunn@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: toby dunn <tobydunn@HOTMAIL.COM>
Subject: Re: how to get every m observation from one data set
Content-Type: text/plain; format=flowed
Not very elegant but does he job, I will leave it to you to refactor .
Data Need ( Drop = A Cnt ) ;
Set One Nobs = Nobs ;
Array Var ( 3 ) Var1-Var3 ;
Retain Var1 Var2 Var3 ;
Cnt + 1 ;
Var( Cnt ) = A ;
If ( Cnt = 3 ) Or ( _N_ = Nobs ) Then Do ;
Cnt = 0 ;
Var1 = 0 ;
Var2 = 0 ;
Var3 = 0 ;
Data = Need ;
Quickly, bring me a beaker of wine, so that I may wet my mind and say
Wise people, even though all laws were abolished, would still lead the same
You should not decide until you have heard what both have to say.
From: Ming Chen <chenming@GMAIL.COM>
Reply-To: Ming Chen <chenming@GMAIL.COM>
Subject: how to get every m observation from one data set
Date: Wed, 8 Nov 2006 16:08:02 -0500
Here is the sample data:
Here is the data I want for every 3 obs:
1 4 7
2 5 8
3 6 9
10 0 0
I set the data to 0 if no such position.
I tried to transpose first then use array. But the code is very complicated
and can not deal with the irregular data.
Thanks in advance.
Find a local pizza place, music store, museum and more…then map the best