BookmarkSubscribeRSS Feed
suraestar
Calcite | Level 5

How to Obtain **OTHER** Format values ???

Consider the below code


proc format;
value first
2='Two'
3='Three';

value final
1='One'
other=[first.];
run;


proc format library=work cntlout=formats;
run;


Dataset content from format dataset.

Expected Output:
FMTNAME  START   LABEL
FINAL            1        One
FINAL            2        Two
FINAL            3        Three

Actual Output
FMTNAME  START   LABEL
FINAL            1             One
FINAL    **OTHER**      FIRST40.

Many Thanks...


Capture.PNG
4 REPLIES 4
Keith
Obsidian | Level 7

Your FINAL format says to display 1 as 'One', with any other value displayed using the FIRST. format.  This means that 2 and 3 will be formatted as 'Two' and 'Three', whereas other numbers will be displayed as they are stored, due to not being included in the FIRST format.  The OTHER statement covers all other values, not just those included in the FIRST format, therefore your cntlout output is correct

suraestar
Calcite | Level 5

Yes, my output is correct. but i need the expected output.. Since i will be using some process based on that dataset..

Keith
Obsidian | Level 7

You either need to detail the specific values in the format statement (2,3 = [first.])

or use the FIRST format values as well as those from FINAL in the cntlout output.

suraestar
Calcite | Level 5

Thanks Keith...

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 508 views
  • 0 likes
  • 2 in conversation