• C++ Programming for Financial Engineering
    Highly recommended by thousands of MFE students. Covers essential C++ topics with applications to financial engineering. Learn more Join!
    Python for Finance with Intro to Data Science
    Gain practical understanding of Python to read, understand, and write professional Python code for your first day on the job. Learn more Join!
    An Intuition-Based Options Primer for FE
    Ideal for entry level positions interviews and graduate studies, specializing in options trading arbitrage and options valuation models. Learn more Join!

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.
 
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
 
C++:
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