Automatic date selection from Excel import

For requesting general information about EViews, sharing your own tips and tricks, and information on EViews training or guides.

Moderators: EViews Gareth, EViews Moderator

justincn
Posts: 7
Joined: Mon Mar 11, 2024 4:20 pm

Automatic date selection from Excel import

Postby justincn » Fri Dec 12, 2025 1:42 pm

Hello everyone,

Is it possible to import an Excel file without having to hardcode the start date? For example, if I have the following code

Code: Select all

import(page=DATA) %data range ="Sheet1" @freq q 1980

My question is this: Is there a way to get around having to add 1980 and automatically detect the start and end dates of the sheet?

For reference, the data looks like this (note the second and third series begin in 1990)

Code: Select all

quarter sales laborforce household Q1-80 813038 Q2-80 795216 Q3-80 815587 Q4-80 850848 Q1-81 856297 Q2-81 902501 Q3-81 899384 Q4-81 890007

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13598
Joined: Tue Sep 16, 2008 5:38 pm

Re: Automatic date selection from Excel import

Postby EViews Gareth » Sun Dec 14, 2025 3:17 pm

Not with the non-standard date format you have. If the dates are written in a standard format, EViews will generally interpret it just fine.

A possible work around would be to import the file into a new EViews page, completely undated, then create a date series based on the date format you are using, and then copy from that new page to your actual destination page.

justincn
Posts: 7
Joined: Mon Mar 11, 2024 4:20 pm

Re: Automatic date selection from Excel import

Postby justincn » Mon Dec 15, 2025 9:49 am

Thanks, Gareth.

Is there a standard format that would work quarterly dates?

1980Q1? 1980-Q1? etc.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13598
Joined: Tue Sep 16, 2008 5:38 pm

Re: Automatic date selection from Excel import

Postby EViews Gareth » Mon Dec 15, 2025 11:44 am

1980Q1 should work. But also just the date of the first day of the quarter.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13598
Joined: Tue Sep 16, 2008 5:38 pm

Re: Automatic date selection from Excel import

Postby EViews Gareth » Mon Dec 15, 2025 11:59 am

You could also probably get away with this, with your initial format:

Code: Select all

import(page=data) %data @id @date(@dateval(quarter,"[Q]Q[-]YY")) @destid @date

justincn
Posts: 7
Joined: Mon Mar 11, 2024 4:20 pm

Re: Automatic date selection from Excel import

Postby justincn » Mon Dec 15, 2025 2:19 pm

Thanks, Gareth!


Return to “General Information and Tips and Tricks”

Who is online

Users browsing this forum: No registered users and 2 guests