BookmarkSubscribeRSS Feed
YannRC
Obsidian | Level 7

Hi, i'm not sure to be in the good location. I prepare data with sas data studio. I want to sort my data with a date. I know that i can use a function in studio with case and INTCK but i would like to do this on SAS data studio by using a calculated collumns. But i dont' find the function case and if i use IF, i have an error. Can you help me?

4 REPLIES 4
PaigeMiller
Diamond | Level 26

Show us the log for your code (all of it, not just the errors)

 

Show us a portion of your data.

--
Paige Miller
ballardw
Super User

CASE as a statement pretty much only exists in Proc SQL and is not a function. So I am pretty confused as to what sort of code you even attempting.

 

LinusH
Tourmaline | Level 20

The calculated column transformation accept data step syntax, but does not allow conditional values. Help within the product:

"Creating Calculated Columns

To create a calculated column, enter a DATA step expression in the Expression field. A few considerations:
  • Do not include the name of the table, semicolons, or the column= statement in the expression. They are implicitly added for you.
  • Enter a single value or single expression only. Do not enter conditional values.

For more information about creating calculated columns, see Creating Calculated Columns in SAS Data Studio: User’s Guide."

 

That being said, INTCK should work.

If wish to do conditional processing, use IFC/IFN functions rather than the corresponding statements.

LinusH_0-1696939718323.png

 

Data never sleeps
Tom
Super User Tom
Super User

Perhaps this is an actual use case for the IFN() or IFC() functions that SAS added a few years ago?

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 474 views
  • 1 like
  • 5 in conversation