BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Hansi_12345
Fluorite | Level 6

Hi guys, it's me again.

 

You helped me a lot but i have one more question 😄

 

I have the following code:

data Work.test;
      set input;
      value = 0.4* value_input;
      reference_number = if value > 0 then reference_number = 123 else 345;
run;

My data has different positive and negative values in the variable value_input.

The aim should be, that positive values get the reference_number  345 and all other values get the reference_number 123.

 

I get three syntax errors:

1. Missing !,!!, & ...

2. Expecting an arithmetic operator

3. The option or parameter is not recognized and will be ignored

 

Would be great if you could help me

 

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Hansi_12345
Fluorite | Level 6

I found the solution. 😄

 

data Work.test;
      set input;
      value = 0.4* value_input;
      if value > 0 then reference_number = 123; else reference_number = 345;
run;

Sorry for disturbing you.

 

Have a nice day 😄

 

View solution in original post

2 REPLIES 2
Hansi_12345
Fluorite | Level 6

I found the solution. 😄

 

data Work.test;
      set input;
      value = 0.4* value_input;
      if value > 0 then reference_number = 123; else reference_number = 345;
run;

Sorry for disturbing you.

 

Have a nice day 😄

 

ballardw
Super User

Good for you!

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 546 views
  • 2 likes
  • 2 in conversation