First Character Identification... Number or String???

For questions regarding programming in the EViews programming language.

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

kcaron
Posts: 101
Joined: Wed Mar 04, 2015 11:46 am

First Character Identification... Number or String???

Postby kcaron » Wed Jul 24, 2024 10:42 am

I'm trying to identify if the first character of a variable is a number or string.

My variable is %myvar and I am running a loop which is picking up cusips (numbers) and tickers (strings) from a group.

I am using @left to identify what the first character.

However, I need something to tell me if it is a number or a letter.

Does EViews have such a command?

Thanks!
KC

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

Re: First Character Identification... Number or String???

Postby EViews Gareth » Wed Jul 24, 2024 12:38 pm

Code: Select all

@isna(@val(@left(%myvar,1)))
Will return 1 if it is a character, and 0 if it is a number.

kcaron
Posts: 101
Joined: Wed Mar 04, 2015 11:46 am

Re: First Character Identification... Number or String???

Postby kcaron » Wed Jul 24, 2024 1:25 pm

Worked great! Thank you!!
KC


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests