Quarterly data

How can I enter quarterly data because if I type 1970-1 gauss do the subtraction, and if I type 1970.1 gauss send me an error message?

1 Answer



0



For dates in GAUSS you want to use what is called "Date Time" or DT format. A DT format number is simply a number in which the first 4 digits represent the year, the next 2 represent the month, the 2 after that represent the day. So 19701003 would represent January 3, 1970.

GAUSS has a function that will translate a DT number like the one above into a formatted string. It is called dttostr and can be used like this:

dt = { 19700103, 19700401 };
fmt = "YYYY-QQ";
print dttostr(dt, fmt);

This code above will output:

1970-Q1
1970-Q2

The format input (fmt in the example above) to dttostr is quite flexible and will allow you to put the different parts of the date such as year, quarter, month day in any order. You can also add any characters you would like to your output string. Here is another example:

dt = { 19700103, 19700401 };
fmt = "QQ/YYYY";
print dttostr(dt, fmt);

This code above will output:

Q1/1970
Q2/1970

If you have a string of dates similar to the output above you can convert it back to DT format with the GAUSS function strtodt. Note that support for the QQ format element is new to dttostr and strtodt in GAUSS version 13.

Your Answer


You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 30 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy