Date: Wed, 22 Oct 2008 09:19:57 -0500
Reply-To: "./ ADD NAME=Data _null_," <iebupdte@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "./ ADD NAME=Data _null_," <iebupdte@GMAIL.COM>
Subject: Re: data position control in array
In-Reply-To: <7835865e-ab35-40e1-b441-9108c4fc59f4@k13g2000hse.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
data work.scores;
input number @;
array score[5];
subj = _n_;
do _n_ = 1 to number;
input score[_n_] @;
end;
input age;
cards;
5 90 80 70 77 88 23
2 100 99 25
3 87 85 88 35
;;;;
run;
proc print;
run;
On 10/22/08, fuqiang0316@gmail.com <fuqiang0316@gmail.com> wrote:
> data set:
>
> 5 90 80 70 77 88 23
> 2 100 99 25
> 3 87 85 88 35
>
> first column is the times of the test. others are scores. the last
> number in each row is the age of the person who took the tests
>
>
> want to have:
>
> Obs SCORE1 SCORE2 SCORE3 SCORE4 SCORE5 NUMBER SUBJ AGE
> 1 90 80 70 77
> 88 5 1 23
> 2 100
> 99 . . . 2
> 2 25
> 3 87 85
> 88 . . 3 3 35
>
>
> note: 1. in original data set, no space for missing values. 2, have to
> finish with array.
>
> thanks,
>
|