BookmarkSubscribeRSS Feed
GS10
Fluorite | Level 6

 

Hi,

 

I m trying to create a calculated fieldfor a report. I have to create an item with a range and I using If else boolean for this. Here, i have to get the output as numeric with combination of date and numeric. i m not able to create an item with date and range between numeric where as the ouput should be a nuemeric. Please suggest..

8 REPLIES 8
Sam_SAS
SAS Employee

Hello,

 

 

Can you provide some more information about the calculated expression that you want to create?

 

Do you need to compare numerics and dates?

 

It wouldn't be as simple as something like this would it?

 

IF ( 'Date'n BetweenInclusive('7MAR2017'd, '28MAR2017'd) )
RETURN 'Profit'n
ELSE .

Thanks,

Sam

GS10
Fluorite | Level 6
Yes..

IF ( 'Numeric'n BetweenInclusive('numeric', 'numeric') )
RETURN 'text string'n
ELSE .
Sam_SAS
SAS Employee
Are you getting a message about argument types not matching?

In the VA expression syntax, . is a numeric missing value and '.' is a character missing value. If your RETURN parameter is character, then try,

IF ( 'Numeric'n BetweenInclusive('numeric', 'numeric') )
RETURN 'text string'n
ELSE '.'
GS10
Fluorite | Level 6

Yes..

GS10
Fluorite | Level 6

Can someone solve this  ??

Sam_SAS
SAS Employee
Did you try putting quotes around the missing value for your ELSE statement?
GS10
Fluorite | Level 6

Thanks! Yes, I tried it and its working. 

Sam_SAS
SAS Employee

Great! Thanks for following up.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 8 replies
  • 1392 views
  • 0 likes
  • 2 in conversation