Date: Tue, 18 May 1999 12:37:42 -0400
Reply-To: "Paul M. Dorfman" <sashole@EARTHLINK.NET>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: "Paul M. Dorfman" <sashole@EARTHLINK.NET>
Subject: Re: [Warning] Retain statement to control variable's order in
dataset
Content-Type: text/plain; charset=us-ascii
JP wrote:
> I read once here that you could control the variable's order in the dataset
> by using a RETAIN statement.
> I tried it. It seems to work fine, as it orders variables the way I
> specifies it.
> But it creates errors, with missing values. From the RETAIN synthax, it
> seems that: If an obs has a missing value for a given var, it puts the
> value of the previous observation, for the given var.
> I remember someone proposing SQL to do this, with SELECT.
> This should work properly.
JP,
Could you give an example? Judging from this code snippet, the RETAIN statement
fails to exhibit the behavior you described:
DATA XY; INPUT X Y; LINES;
1 9
2 .
3 4
. 3
5 2
6 .
7 1
. 2
4 3
;
RUN;
DATA YX; RETAIN Y X; SET XY; RUN;
PROC PRINT; RUN;
OBS Y X
1 9 1
2 . 2
3 4 3
4 3 .
5 2 5
6 . 6
7 1 7
8 2 .
9 3 4
And this:
PROC SQL; SELECT Y, X FROM XY; QUIT;
produces exactly the same output.
Kind regards,
++++++++++++++++
Paul M. Dorfman
Jacksonville, FL
++++++++++++++++
|