SunQuest
           Other Programming Languages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreOther Programming Languages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old July 31st, 2006, 07:21 AM
swlau swlau is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Posts: 1 swlau User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 25 m 43 sec
Reputation Power: 0
From Excel VBA to SAS

Hello,

This is my first post. Please be forgiving.

I have written a couple of macros in Excel which reads through my data sequentially and jumps back to previous observations. For example:
Code:
Sub aggregate()

Dim count As Integer
Dim countstart As Integer
Dim aggregate As Double
Dim period As Integer
Dim agg As Double

period = 1

For period = 1 To 4
count = 2
countstart = 2
For count = 2 To 3950
    If Worksheets("output").Cells(count, 7).Value = Worksheets("output").Cells(count - 1, 7).Value Then
        aggregate = aggregate + Worksheets("output").Cells(count, 11).Value * Worksheets("output").Range("P1:S6438").Cells(count, period).Value * (1 - Worksheets("output").Cells(count, 20).Value)
        agg = agg + Worksheets("output").Cells(count, 11).Value * Worksheets("output").Range("P1:S6438").Cells(count, period).Value * Worksheets("output").Cells(count, 20).Value
        
    Else:
        Do Until countstart = count + 1
            If Worksheets("output").Range("P1:S6438").Cells(countstart, period).Value = 1 Then
                Worksheets("output").Range("V1:V6438").Cells(countstart, 1).Value = aggregate * (1 - Worksheets("output").Cells(countstart, 20).Value) + agg * (Worksheets("output").Cells(countstart, 20).Value)
            End If
            countstart = countstart + 1
        Loop
        countstart = count
        aggregate = Worksheets("output").Cells(count, 11).Value * Worksheets("output").Range("P1:S6438").Cells(count, period).Value * (1 - Worksheets("output").Cells(count, 20).Value)
        agg = Worksheets("output").Cells(count, 11).Value * Worksheets("output").Range("P1:S6438").Cells(count, period).Value * Worksheets("output").Cells(count, 20).Value

    End If
Next

Next

End Sub


I'm wondering whether I should try converting these into SAS or just perform these steps in Excel where necessary.
a) I have a lot of data. Many, many excel files are needed.
b) I need to match other data from other databases as well, which could be done in SAS.
c) Eventually, I need to perform statistical analysis on the data.

I'm not very familiar with SAS at all. I think I would transpose the data and then declare an array? Or is there some other way to explicitly reference each column, row?

Further, I think I would run out of columns if I have to transpose all my data in SAS.

Thanks in advance,
Sarah

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreOther Programming Languages > From Excel VBA to SAS


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway