BookmarkSubscribeRSS Feed
FW1809
Calcite | Level 5

Dear All,

 

As a first year student and a rookie in SAS programming, I am having some difficulty in establishing a firm level cost stickiness proxy as used in Dan Weiss (2010)'s Cost Behavior and Analyst' Earnings Forecast Paper. Specifically, for each firm quarter observation, I need to go back to the last four recent quarters (t,t-1,t-2,t-3) and extract the most recent of this last four quarters with decrease in sales and the most recent of this last four quarters with increase in sales to compute the difference in sales and costs in these two quarters. For example:

 

GVKEY    Datadate     Sales       Sale change   Direction of Change    Quarter 

000010    20180331    10.8810   0.707                       Increase                 t-3

000010    20180630    8.8520     -2.029                     Decrease                t-2

000010    20180930    8.5670     -0.285                     Decrease                t-1

000010    20181231    9.3170     0.75                        Increase                  t

 

According to my understanding of the paper, what I need to do is to choose the most recent quarter of the last four quarters (t to t-3) with decrease, which is the 20180930 in the example (t-1) and the most recent quarter with increase, which is the 20181231 in example (t) and compute the difference between these two in terms of sales and costs. The process is rolling backwards every four quarters. Now, I have difficulty to 

 

1) extract these two quarters with that four quarters. For each quarter observations, the quarters chose could be different depending on how the sales change.

 

2) what if for some firm-quarter observations, there is only sales increase or only sales decrease with its last four recent quarters, can I still establish such measurement for firm-level cost stickiness?  

 

Thanks a million for anyone who can provide me any tips or help on that!

 

3 REPLIES 3
ballardw
Super User

Some basic question:

Do you have your data in a SAS data set? (Sometimes folks don't and our answers don't make much sense)

Are your date values actually SAS data values with a format such as YYMMDDn8. applied? If not that will be one of the first steps because you looking to manipulate dates. SAS supplies a number of functions that work with date values to do things like count intervals such as quarters.

Do you have the data as quarters with totals already or do you need to get the total per quarter from something like daily values?

And are your quarters the typical Jan to Mar as quarter 1, Apr to Jun as 2 and so on?

FW1809
Calcite | Level 5

Thanks a lot for the quick reply! To answer your questions, 

 

1), yes, indeed. My data is in a SAS data set.

2), My date values are SAS data values with a format such as YYMMDDn8. (Datadate in Compustat North America Quarterly dataset)

3), The variables I have on hand is for quarter value already. Therefore, I do not need to compute the sales or costs for each quarter again. All I need to do is to use these quarterly values to computer firm-level cost stickiness measure following the Weiss (2010). 

4), unfortunately, it is not. What I observed is that for some firm, some year, there are differences between how quarter end is recorded. Also, some firms in certain years may have quarterly data missing (only contain three quarters)

 

for example, the first a couple of rows I have looks like the following:

 

GVKEY       DataDate    Calendar Data Year and Quarter          Fiscal Date Year and Quarter

001003       19840331                   1984Q1                                                 1984Q1

001003       19840630                   1984Q2                                                 1984Q2

001003       19840930                   1984Q3                                                 1984Q3

001003       19860131                   1985Q4                                                 1985Q4

001003       19860430                   1986Q1                                                 1986Q1

001003       19860731                   1986Q2                                                 1986Q2

001003       19861031                   1986Q3                                                 1986Q3

------                    -----                     -----                                                       ---------

As you can see, even within the same year, there are situations like missing quarters and different datadate for the same quarter (1984 vs 1986). However. I would say that at least 80% of my observations follows regular pattern as 0331 for first calendar quarter, 0630 for the second calendar quarter and so on. The rest of obs seems to follow the pattern like  0430, 0731, 1031 and 0131 for most of times. (I have 361,688 obs in total).

 

Again, thanks a lot for your time and help and hopefully there is a way to resolve this problem here. 

 

Thanks!

 

 

 

ozioh19
Calcite | Level 5

Hi,

It has been a while but can you share your code so that we can take a look at the issue.

 

Thank you.

 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 912 views
  • 0 likes
  • 3 in conversation