how to get a string of a month from a scalar

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

melamel
Posts: 30
Joined: Tue May 10, 2016 3:49 am

how to get a string of a month from a scalar

Postby melamel » Sun May 15, 2016 3:39 am

hello,
I want to get a string month from a number, so I wonder If there is a function which transforms a number to a string of the month corresponding to the number I give in input, for example if I give 3 it will gives me Mars...etc but I want it just for the month, not for the hole date. Can you help me please ?

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

Re: how to get a string of a month from a scalar

Postby EViews Gareth » Sun May 15, 2016 4:30 am

I am sure there is an easier way, but I am drawing blank at the moment, so this rough idea will have to do.

You can use @datestr to convert a date number into a string, including just the month part.

The trick is going to be getting a date number from your "3".

You could start with the date value associated with the date "01/01/2016", then use the @dateadd function to add months to it to end up with a valid date number to use.

melamel
Posts: 30
Joined: Tue May 10, 2016 3:49 am

Re: how to get a string of a month from a scalar

Postby melamel » Sun May 15, 2016 6:41 am

Thank you very much! It worked well :D


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests