Hello!
Is it more efficient to replace Case when by proc Format?
Thanks
Yes, it is more efficient and if you're doing it in more than one place, very recommended.
@ssafmed wrote:
Hello!
Is it more efficient to replace Case when by proc Format?
Thanks
Yes, it is more efficient and if you're doing it in more than one place, very recommended.
@ssafmed wrote:
Hello!
Is it more efficient to replace Case when by proc Format?
Thanks
I would add that the larger the data set and the greater the number of "cases" involved the more friendly the use of a format becomes.
Case/when is pretty verbose plus requires running the entire data set through the transformation when the rules change. If your data set is large the time just to execute the transformation can become significant. Using a format on values for analysis or reporting pretty much skips that processing time.
Also a data set of values can be used to create formats if your rules are provided in a nice structure this may be a quick way to get the behavior you need.
Typically, PROC FORMAT uses less space in the SAS data set than creating the values as text strings. PROC FORMAT has a lot of other benefits as well ... one benefit is that if you decide your categories need to be changed, you can just change the format, rather than re-running the SQL to extract the data and apply the CASE statement.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.