Good afternoon,
I have a VAR which I have applied a format to assigning many observations (100 plus) to a single observation. Think along the lines of- if you live in Washington State you live in the NorthWest. So the trouble I am having is the Northwest is a number 002 and (the short of the long of it is) it is not an option to change the format. Is there a way to apply a second format over the first, after the first has been applied? Is there a different way I should be thinking about this?
Thanks for any help,
@kmj636 wrote:
Good afternoon,
I have a VAR which I have applied a format to assigning many observations (100 plus) to a single observation. Think along the lines of- if you live in Washington State you live in the NorthWest. So the trouble I am having is the Northwest is a number 002 and (the short of the long of it is) it is not an option to change the format. Is there a way to apply a second format over the first, after the first has been applied? Is there a different way I should be thinking about this?
Thanks for any help,
Why do you need both values? Instead you may need to create a new variable that holds what you want.
@kmj636 wrote:
Good afternoon,
I have a VAR which I have applied a format to assigning many observations (100 plus) to a single observation. Think along the lines of- if you live in Washington State you live in the NorthWest. So the trouble I am having is the Northwest is a number 002 and (the short of the long of it is) it is not an option to change the format. Is there a way to apply a second format over the first, after the first has been applied? Is there a different way I should be thinking about this?
Thanks for any help,
Why do you need both values? Instead you may need to create a new variable that holds what you want.
I think I have found my solution with nested formats but if someone else has a better idea please let me know.
"More than just a Value" http://www2.sas.com/proceedings/sugi26/p018-26.pdf
Thanks!
Nested is usually used for when you want to show different formats for different values, ie numbers less than 0 are shown as 'Less than 0' but everything above is shown as Percent12.2 or something. That didn't quite seem the case with your description, but if it works that's all that matters in the end.
proc format;
value custom_pct
low - 0 = "less than 0"
other = [Percent12.2];
run;
No I think you are right and your solution seems to be the easiest. I will create a new VAR for the new format and then apply the second format to the new VAR.
Thank you for your help! I appreciate it.
Some actual example data and desired results might be helpful.
For some uses perhaps a multilabel format would work, but only a few procedures will honor multilabel such as Proc Tabulate, Report and Means/Summary.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.