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

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,

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

@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.

View solution in original post

5 REPLIES 5
Reeza
Super User

@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
Obsidian | Level 7

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!

 

Reeza
Super User

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;
kmj636
Obsidian | Level 7

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.

ballardw
Super User

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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 5 replies
  • 858 views
  • 4 likes
  • 3 in conversation