| Date: | Fri, 14 Aug 1998 09:36:43 -0400 |
| Reply-To: | Jon Patton <pattonjm@PO.MUOHIO.EDU> |
| Sender: | "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU> |
| From: | Jon Patton <pattonjm@PO.MUOHIO.EDU> |
| Subject: | Re: going from (1 x 288) to (6 x 48) |
|
| Content-type: | text/plain; charset="us-ascii" |
|---|
At 02:54 PM 8/10/98 -0400, Daniel Pelic wrote:
>I have a dataset which contains only one variable called PERCENT,
>and 288 observation under it.
>
>14.11
>5.6
>3.7
>5.76
>11.32
>3.45
>2.78
>4.67
>3.49
>...
>...
>...
>and so on.
>
>So basically I have 1 column and 288 rows (1 x 288).
>
>How can I create a new dataset which would have 6 variables
>(var1 to var6) that would take the 288 observations and put
>then in rows of 6.
>
>It would look like this:
>
>var1 var2 var3 var4 var5 var6
>14.11 5.6 3.7 5.76 11.32 3.45
>2.78 4.67 3.49................................
>.........................................................................
>
>...........................and so on.
>
>So basically I would have 6 column and 48 rows (6 x 48).
>
>Any help would be greatly appreciated !
>
This can be done using the mod function. The following program worked for
12 percent values so it should
work for 288:
data one;
retain var1-var6;
input percent;
array vv{6} var1-var6;
remain=mod(_n_,6);
if remain ge 1 then vv{remain}=percent;
else do;
vv{6}=percent;
output;
end;
cards;
14.11
5.6
3.7
5.76
11.32
3.45
2.78
4.67
3.49
...
...
...
run;
proc print;
var var1-var6;
run;
|