Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SAS programming help needed, time alignment

Status
Not open for further replies.

lulumohca

Programmer
May 8, 2008
8
US
Hi, if someone can help me with this it would be greatly appreciated. I have a data that looks like:

jan-05 feb05 ... mar09 (by month along the columns)
a
b
c
d
...



The problem is say variable a first get data at feb05 so before that it would have all zeros, all the different variables starts getting non-zeros at different time.

How do i make this to a new dataset that has:

1st.month 2nd.month ...... x.month first24monthsum
a
b
c
d
...

So I can have each variable showing the first month it has data and onwards (so no leading zeros). And also a new column at the end that shows the sum of the first24month that it has data.

Thanks!!
 
Here is a better explaination of what I am trying to do:

data test ;
Input Week $ J05 F05 M05 A05 ;
Datalines;
product1 12 0 0 2
product2 0 0 0 4
product3 0 7 0 5
product4 0 10 9 8
product5 0 50 20 0
Run;

Results:

data result ;
Input Week $ fristm secondm thirdm fourthm ;
Datalines;
product1 12 0 0 2
product2 4 0 0 0
product3 7 0 5 0
product4 10 9 8 0
product5 50 20 0 0
Run;

So I have this dataset that has different products and they each have different release month of when they go on the market. because my original dataset starts at J05 while some products release later (product5 releases in F05)
I want to make the data set so instead of the columns going JAN05 F05...
I want it to show 1st month of sales, 2nd month of sales for each product.

Thanks!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top