Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8033531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:43:43+00:00 2026-06-05T01:43:43+00:00

my problem is that I have some data that is quarterly but needs be

  • 0

my problem is that I have some data that is quarterly but needs be recalculated daily using another daily value. Basically, I am working with quarterly financial data but I need to recalculate some of the ratios for a daily frequency using daily price data. In this case below, I am given a value for c.atq and c.csh12q quarterly and a value for s1.prccd daily. I need to calculate the ratio for the current c.atq using the current s1.prccd. When the the c.atq changes at the end of the quarter, the process should continue with the new value.

 select s1.DATADATE, c.ATQ, s1.PRCCD, c.ATQ/(s1.PRCCD*c.CSH12Q) as PATQ
 from sec_dprc s1 
 left outer join co_ifndq c 
 on s1.GVKEY = c.GVKEY
 and s1.DATADATE = c.DATADATE
 where s1.GVKEY = 008068
 order by s1.DATADATE

this is small table of the results:

DATADATE            ATQ     PRCCD   PATQ
19/12/1984 00:00    NULL    28      NULL
20/12/1984 00:00    NULL    27.25   NULL
21/12/1984 00:00    NULL    27.5    NULL
24/12/1984 00:00    NULL    27.5    NULL
26/12/1984 00:00    NULL    27.5    NULL
27/12/1984 00:00    NULL    27.625  NULL
28/12/1984 00:00    NULL    27.75   NULL
31/12/1984 00:00    12273   28      4.400022371
02/01/1985 00:00    NULL    27.5    NULL
03/01/1985 00:00    NULL    26.75   NULL
04/01/1985 00:00    NULL    25      NULL
07/01/1985 00:00    NULL    24      NULL
08/01/1985 00:00    NULL    25      NULL
09/01/1985 00:00    NULL    25.375  NULL

I need the value of c.ATQ to be duplicated over all the following daily dates until it changes next quarter.

Thanks!!

part 2:

GVKEY   rankx   rdq                 QTR ATQ         CSH12Q  DATADATE
008068  2   1984-02-03 00:00:00.000 1   11775.402   96.569  1983-12-31 00:00:00.000
008068  3   1984-05-07 00:00:00.000 2   11428.602   96.751  1984-03-31 00:00:00.000
008068  4   1984-08-02 00:00:00.000 3   11642.902   98.104  1984-06-30 00:00:00.000
008068  5   1984-10-18 00:00:00.000 4   11654.5     98.984  1984-09-30 00:00:00.000

similarly:

DATADATE                ATQ     PRCCD   PATQ    datadate    rdq
1984-01-31 00:00:00.000 NULL    28      NULL    NULL    NULL
1984-02-01 00:00:00.000 NULL    28.625  NULL    NULL    NULL
1984-02-02 00:00:00.000 NULL    27.875  NULL    NULL    NULL
1984-02-03 00:00:00.000 11775.2 26.75   4.55841 1983-12-31  1984-02-03 00:00:00.000
1984-02-06 00:00:00.000 NULL    27      NULL    NULL    NULL
1984-02-07 00:00:00.000 NULL    26.875  NULL    NULL    NULL
1984-02-08 00:00:00.000 NULL    25.75   NULL    NULL    NULL
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T01:43:45+00:00Added an answer on June 5, 2026 at 1:43 am

    If there isn’t a key already to link the quarterly date, an id could be emulated by using something like

     select DATEPART(YYYY,datetimevalue) * 10 + DATEPART(q,datetimevalue)
    

    Syntax wise it would look better with a function , but it should work by changing the datetime part of the join to:

      DATEPART(YYYY,s1.DATADATE) * 10 + DATEPART(q,s1.DATADATE) = DATEPART(YYYY,c.DATADATE) * 10 + DATEPART(q,c.DATADATE)
    

    If that gives double records, a common table expression (with) could be used to get the quarterly data separately first.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my Android app, I have some data that needs to be synced daily
I am loading some text dynamically into a div, but have the problem that
I have a database that has been populated with some data using create and
I have a some code below. My problem that i have a strange ending
I have the problem that when I try to copy some files from php
I have a problem that I'm hoping to get some direction in solving -
I have a small problem that I am hoping to get some help with.
I am doing some localization and have bumped into a problem that I cant
I have some code that I'd like to run on a page. My problem
I have the following problem with Tikz/Latex: I have some nodes that contain text.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.