BookmarkSubscribeRSS Feed
mflore
Calcite | Level 5
I am trying to create a permanent format with the goal of changing how skipped values are displayed in Proc Print. The character variable "Reason" is currently coded as ".SK" for skipped values. I would like them to display as "Skipped" when printed. Here is my code:

proc format library = MyFmt;
value $ReasonFmt
'.SK' = 'Skipped';
run;

proc print data = Data1;
var Reason;
format Reason $ReasonFmt.;
run;

The problem is that non-skipped values (e.g. "No applicable insurance" and "Patient transferred care") get truncated to 3 characters (e.g. "No " and "Pat"). Is there a way to change the display of ".SK" while maintaining the way all other values are printed?

Thanks for your help.
1 REPLY 1
ballardw
Super User
The default length of a format is the length of the longest formatted value.

You need to specify a DEFAULT= in the value statement:

value $ReasonFmt (default=15)

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1 reply
  • 651 views
  • 0 likes
  • 2 in conversation