Date: Tue, 27 Oct 2009 10:45:25 -0400
Reply-To: Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Subject: Re: confirming consecutive observations (lag? array?) and
changing missing numeric values.
the missing value question: I think it is not of use to change that value.
That value is not really missing (there must be something, the memory is
not gone). It is simply a convention that a certain content is interpreted
as "no value". It is useful that any software uses the same conventions.
For sure it might be possible to use something different, but that might
cause confusion. Also there is a problem with the portability, if you use
other values. I think that the idea to present it as a dot comes from
former mainframe days. If you open a browser with non-displayable data,
you see dots. That are not all missing, that means only that the byte is
not in the EBCDIC table, but the idea for the representation of "nothing"
might come from there. That has nothing to do with the value of the
byte "behind", which might also be different on other platforms.
To change that value "behind" is very complicated, because that would have
many implications. To change the apperance is easy, because that changes
nothing of the logic (ok, not much).
Gerhard
On Tue, 27 Oct 2009 06:58:49 -0700, Brian Wallace
<brian_c_wallace@YAHOO.COM> wrote:
>I swear that once I get time I'm going to review the SAS-L digests and
deepen my knowledge of SAS applications, procedures and good programming
practices. We've been swamped for a while. I just want everyone to know
that I very much appreciate this list when I can access it and I'm not
QUITE as awful a programmer I may seem based on some of my questions. Any
help with this is appreciated.
>
>1.) I'm almost sure the answer to this is "NO" but I don't want to be a
programmer with a concrete view of always being correct: Is there a way
to change a null numeric variable from being '.' in the actual data set?
OPTIONS MISSING = '' or whatever will change the DISPLAY of the empty
numeric field in the output window. But looking at the actual data set in
a SAS viewer, if it's a null numeric field it will always be '.'?
>
>2.) I'm trying to confirm consecutive grades. Here's an example:
>
>DATA TEST1;
> INPUT TERM $ 1-2 GRADE $ 4;
>DATALINES;
>BL
>T1 A
>T2 A
>T3 B
>T4 A
>T5 B
>BL
>T1 A
>T2 B
>T3 B
>T4 A
>;
>RUN;
>
>Suppose if the consecutive grades are 'A,A', 'A,B','B,A' or 'A,missing'
then the confirm grade is 'A'. If the consecutive grades are 'B,B'
or 'B,missing'then the confirm grade is 'B'. The confirm grade would have
to be associated with the FIRST of the two observations and if the term is
BL than there is no confirm grade. Like this:
>
>TERM GRADE CONFIRM_GRADE
>BL
>T1 A A
>T2 A A
>T3 B A
>T4 A A
>T5 B B
>BL
>T1 A A
>T2 B B
>T3 B A
>T4 A A
>
>I thought of two approaches:
>
>A.) An array. I guess it would have to be two-dimensional (2,11) array?
But the BL terms don't have grades and they aren't at regular intervals.
>
>B.) Using the LAG function. But I don't think you can assign variable
values with LAG can you? Like, if IF LAG(TERM) = 'A' AND TERM = 'A' THEN
LAG(CONFIRM_GRADE) = 'A'? That's not allowed. Plus, to use LAG you
can't "skip" over observations. That's what I'd have to do with the BL
terms.
>
>The actual problem has many more grades and the criteria for confirmation
grades is more complicated but I figure if I can successfully get my
example working, I should be ok.
>
>Very much thanks for your time, any help or directing me to further
helpful information.
>
>Sincerely,
>
>Brian Wallace
|