Desktop productivity for business analysts and programmers

Issues with "Replace a range of values" in EG 3.0 and 4.1

Reply
N/A
Posts: 0

Issues with "Replace a range of values" in EG 3.0 and 4.1

Hello

I'm doing an evaluation of SAS Enterprise Guide, to test if it can be used to teach Students and I ran into a problem when I try to replace a range of values.
The problem consists in both Versions EG3.0 and Learning Edition EG4.1. Perheps Im just doing it the wrong way, but I can't find a solution to it.

I've got an column "Age", which holds the very precise age of Patients, like (14.753424658). Now I have to make a new group column. Patients between the age 5 to 10 get a new value "Child", age 10 to 15 "Teenagers" and so on.
The code that the EG creates looks like this:

(CASE
WHEN 5 <= IMPW9568.Age AND IMPW9568.Age <= 10 THEN 'Child'
WHEN 10 <= IMPW9568.Age AND IMPW9568.Age <= 15 THEN 'Teen'
...
ELSE 'NA' END) AS Age_Group

As you may see the upper limit and the lower limit are overlapping <= 10 is the same as 10<=
But if I change my boundaries, so that they dont overlap:

(CASE
WHEN 5 <= IMPW9568.Age AND IMPW9568.Age <= 9 THEN 'Child'
WHEN 10 <= IMPW9568.Age AND IMPW9568.Age <= 14 THEN 'Teen'
...
ELSE 'NA' END) AS Age_Group

Then I'm getting NA (missings), since all the people between 9 and 10 (9.35367847) are left out.

Perheps it's not a bug, but a feature.
But its a problem for me. I could of course use very precise limits, like:
CASE
WHEN 5 <= IMPW9568.Age AND IMPW9568.Age <= 9.999999999 THEN 'Child'
WHEN 10 <= IMPW9568.Age AND IMPW9568.Age <= 14.999999999 THEN 'Teen'
...
ELSE 'NA' END) AS Age_Group

But perheps there is a better alternative?

SAS Analyst for example has an extra option to chose between a "<= x <" and "< x <=" logic. But a "<=" on both sides, as the EG creates it, just doesn't make much sense to me.

Thank you

Edit:
Perfect would be something like that:

(CASE
WHEN 5 <= IMPW9568.Age AND IMPW9568.Age < 10 THEN 'Child'
WHEN 10 <= IMPW9568.Age AND IMPW9568.Age < 15 THEN 'Teen'
...
ELSE 'NA' END) AS Age_Group

But creatable with EG.


Message was edited by: Tillmann Babik at Mar 26, 2007 6:03 AM


Message was edited by: Tillmann Babik at Mar 26, 2007 6:36 AM
Message was edited by: Tillmann Babik at Mar 26, 2007 6:40 AM
Contributor
Posts: 35

Re: Issues with quot;Replace a range of valuesquot; in EG 3.0 and 4.1

I assume you are using the Create Query function in EG to replace values. That function gives "<=x<=" because it allows you to see every exact value within your dataset.

If you want to have the code set up to handle additional updates, complete the 'Replace Values' information and then go back to the 'General' Tab where you can change the EG generated code to the code you actually want (<=x<).
N/A
Posts: 0

Re: Issues with Replace a range of valuesquot; in EG 3.0 and 4.1

Hi Rab24

Yes I'm working with the create query function. Actually the only other way I would know is to create a format for it.

But your suggestion worked, I must have overlooked that Im able to change the expression afterwards.

Thank you
Frequent Contributor
Posts: 81

Re: Issues with quot;Replace a range of valuesquot; in EG 3.0 and 4.1

Your statement:
"the upper limit and the lower limit are overlapping <= 10 is the same as 10<="

is not true as 10 will be captured by <=10 and not by 10<=.

I don't think you need to change your original code to cope with very precise ages!

..........Phil
Ask a Question
Discussion stats
  • 3 replies
  • 83 views
  • 0 likes
  • 3 in conversation