- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I'm searching for a way to convert quarterly data:
Here's a sample. I have about 150 companies with quarterly data from 2002-2012.
Ticker date Price
AAA 2002/03/31 100
AAA 2002/06/30 125
AAA 2002/09/30 100
AAA 2002/12/31 100
AAA 2003/03/31 102
....
AAA 2012/12/31 95
ABB 2002/03/31 100
ABB 2002/06/30 125
ABB 2002/09/30 110
ABB 2002/12/31 100
ABB 2003/03/31 102
....
ABB 2012/12/31 99
The two problems I'm facing are
1. How to incorporate the ticker, and the fact that we're extrapolating/expanding for mutliple companies.
2. The dates are quarterly end, rather than at the start.
How can I expand this data to monthly or even daily?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Just figured it out, it was the simplest thing!
A BY statement can be used with PROC EXPAND to obtain separate analyses on observations in groups defined by the BY variables. The input data set must be sorted by the BY variables and be sorted by the ID variable within each BY group.
Use a BY statement when you want to interpolate or convert time series within levels of a cross-sectional variable. For example, suppose you have a data set STATE containing annual estimates of average disposable personal income per capita (DPI) by state and you want quarterly estimates by state. These statements convert the DPI series within each state:
proc sort data=state;
by state date;
run;
proc expand data=state out=stateqtr from=year to=qtr;
convert dpi;
by state;
id date;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If you have SAS/ETS licensed, PROC EXPAND does exactly that. - PG
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The two problems I'm facing are
1. How to incorporate the ticker, and the fact that we're extrapolating/expanding for mutliple companies.
2. The dates are quarterly end, rather than at the start.
I have SAS basic and EG.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Since the ID statement cannot handle anything other than a date value and you can't have one date appear more than once (which each date does for each company), how can I repeat the PROC EXPAND process for each company?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Right now what I can think of is perhaps creating a separate dataset for each company, apply PROC EXPAND, then combine the datasets. This would involve hundreds of datasets however....
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Just figured it out, it was the simplest thing!
A BY statement can be used with PROC EXPAND to obtain separate analyses on observations in groups defined by the BY variables. The input data set must be sorted by the BY variables and be sorted by the ID variable within each BY group.
Use a BY statement when you want to interpolate or convert time series within levels of a cross-sectional variable. For example, suppose you have a data set STATE containing annual estimates of average disposable personal income per capita (DPI) by state and you want quarterly estimates by state. These statements convert the DPI series within each state:
proc sort data=state;
by state date;
run;
proc expand data=state out=stateqtr from=year to=qtr;
convert dpi;
by state;
id date;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Great! You should be able to answer your initial request now. - PG