| Date: | Wed, 30 Apr 2003 13:25:10 -0700 |
| Reply-To: | Wei <wei112@HOTMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Wei <wei112@HOTMAIL.COM> |
| Organization: | http://groups.google.com/ |
| Subject: | Re: creating new observations in data step |
| Content-Type: | text/plain; charset=ISO-8859-1 |
A miner change to Edward Heaton's solution. In case you already have a
dataset and each time the number of classes is different.
HtClass: will include all variables start with HtClass, that is:
HtClass1, ....
HtClass85....
data Yourset;
Input
PlotId $
Species $
Count
HtClass1
HtClass2
HtClass3
HtClass4
;
datalines;
xxx Sx 5 2 2 1 .
;
Data test( keep= PlotId Species HtClass ) ;
set YourSet;
Array ht [*] HtClass: ;
Do i=1 to dim(ht) ;
If not missing(ht[i]) then do j=1 to ht[i] ;
HtClass = i ;
Output ;
End ;
End ;
run;
|