BookmarkSubscribeRSS Feed
Saurabh77
Fluorite | Level 6

Hello 

 

I have a simple query. I am trying to get output from selected variable if i apply diffrent limits then it should give me output of selected range

 

What i am facing is if i select show me values that are out side of 100..it is shouwing correct result 

but if i select show me number of article outside of value 75..what it is showing is under 100 and above 75..

 

I want to see all the values above 75....

 

Following you will see the program that i wrote 

 

IF ( 'RFPSCW'n > 100 )
RETURN 'For 100'
ELSE ( 
  IF ( 'RFPSCW'n > 75 )
  RETURN 'For 75'
  ELSE ( 
   
 IF ( 'RFPSCW'n > 50 )
    RETURN 'For 50'
    ELSE 'other' ) )

please help to solve this 

 

Thanks in advance 

8 REPLIES 8
Astounding
PROC Star
This doesn't appear to be a SAS program. Of course I could be wrong and there might be some SAS product that would accept this code.

At any rate, the results you are seeing illustrate the meaning of the word ELSE. Try getting rid of "ELSE" and see if the program still works.
Saurabh77
Fluorite | Level 6
Hi

It is an SAS Program

umm...dont concentrate on RFPSCW word..thats the variable...it contain lot of observation with diffrent values....


coming to your point..i completely agree it would be a problem of ELSE ...what are your personal idea to use insteasd?
Kurt_Bremser
Super User

This is certainly NOT a Base SAS data step program. If you have that in a data step, it's only a big sequence of syntax errors.

Note: "if" REQUIRES a "then", and the statement MUST be terminated with a semicolon before the "else".

With which SAS product/module are you using this code?

 

Quoted:

IF ( 'RFPSCW'n > 100 )
RETURN 'For 100'
ELSE ( 
  IF ( 'RFPSCW'n > 75 )
  RETURN 'For 75'
  ELSE ( 
   
 IF ( 'RFPSCW'n > 50 )
    RETURN 'For 50'
    ELSE 'other' ) )

 

Saurabh77
Fluorite | Level 6

Hello KUurtBremser

 

I am using now SAS VA product

 

Kind of online integrated SAS application to analyze production data

 

One quick que

 

If i want to get output for the same with IF ELSE and THEN statement

 

What would be your program?

 

Thanks in Advance

Saurabh77
Fluorite | Level 6
Thanks for reply

Do you have any programe for example for assigning different limit to the values?

Could you please share
FredrikE
Rhodochrosite | Level 12

Hi!

How do you select the values?

I assume you want to select only on value and get several intervals (>100, >75, etc)

 

One way is to make it possible to select one or more values for example in a list object and then  name the values like (x>100, 75 <= x < 100, 50 <= x <75, etc).

 

Could that help you?

 

//Fredrik

jwward65
Obsidian | Level 7
I have the same issue, can't get the calculated item in SAS VA to evaluate the second if...

IF ( 'Make'n In ('Ford') )
RETURN 'Blue Oval'
ELSE (
IF ( 'Type'n In ('Sport') )
RETURN 'My Favorite'
ELSE 'Everyone Else' )

Did you ever get a resolution?

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 1406 views
  • 1 like
  • 5 in conversation