Date: current quarter

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason

tvonbrasch
Posts: 569
Joined: Fri Apr 15, 2011 5:35 am

Date: current quarter

Postby tvonbrasch » Wed Jul 06, 2016 1:50 am

Hi

I want to generate a string with the current ended quarter.

these codes will do it:

%date=@date
genr adummy=@before(%date)
smpl if adummy<1
genr adummy= na
string aadate=adummy.@last

this gives me "2016Q2", which is what i want.

but, is there a more efficient way?

in contrast,
string aadate2=@datestr(@now-1, "yyyy:q")
yields "2016:3"

Thomas

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

Re: Date: current quarter

Postby EViews Gareth » Wed Jul 06, 2016 7:44 am

Code: Select all

=@datestr(@dateadd(@now, -1, "q"), "YYYY[Q]Q")

tvonbrasch
Posts: 569
Joined: Fri Apr 15, 2011 5:35 am

Re: Date: current quarter

Postby tvonbrasch » Wed Jul 06, 2016 8:45 am

perfect, thanks!
THomas


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests