Help Please

Joined
7/30/10
Messages
5
Points
11
I really need someones help on this

Currently I have this dataset:

Product Expiry
A .
A .
A .
A 20080901
A .
A .
A .
A .
B 20080901
B .
B 20090105


What I want is for all missing values to be filled with the next non-missing value; So we end up with this:
Product Expiry
A 20080901
A 20080901
A 20080901
A 20080901
A 20080901
A 20080901
A 20080901
A 20080901
B 20080901
B 20090105
B 20090105


Does anyone know the code to do this? I really appreciate any help on this.
 
Put this in 3 column excel, your current data in first and second column, then have some condition on third column to fill out the rest. When it populates all, just copy the value of third column over to second column.
 
in which language?

Here's a linux / unix shell version that should support any amount of data:

tac myfile.txt | awk 'NF==2 && $2 ~ /[0-9]+/ {day=$2} !/Product/{print $1,day} /Product/' | tac
 
Code:
Option Base 1

Function weirdCode2(list)
    Dim i, n As Integer
    n = Application.CountA(list)
    
    If Len(list(1)) > 4 Then
        weirdCode2 = list(1)
        Exit Function
    Else
        If n = 1 Then
            weirdCode2 = list(1)
            Exit Function
        End If
        For i = 2 To n
            If Len(list(i)) > 4 Then
                weirdCode2 = Left(list(1), 1) _
                        & " " & Right(list(i), 8)
                Exit Function
            End If
        Next i
    End If
End Function

Create two columns in excel, first column is your data. And then in B1 put " =weirdCode2(A1:$A$11) "

And drag it down, assuming you have 11 total entries
 
Thanks for all your replies guys, sorry my bad I meant to ask in terms of how to do this in SAS.
 
Back
Top Bottom