BookmarkSubscribeRSS Feed
rajeshalwayswel
Pyrite | Level 9

proc format ;
picture intfm(round)
0<-9 = '9 ' (prefix=' ')
10-99 = '99 ' (prefix=' ')
100-999= '999 ' (prefix=' ')
/*., 0= '9 ' (prefix=' ')*/
;
run;

 


data have;
input a;
format a intfm.;
cards;
1
33
556
1
run;

 

When I'm applying intfm format in have data set it correctly not formatting can someone look into it. Please Share if you have any more details on it...Thank you everyone for your response of my questions... 

 

My desired output;

 

    1

  33

556

    1

 

 

 

3 REPLIES 3
Astounding
PROC Star

The pictures you have defined are left-hand justified.  So the printed result is also left-hand justified.  That might make it appear like the format does nothing.  I think you can get what you want with:

 

proc format;

picture intfm (round)  0<-999='999';

run;

 

Note #1:  Your desired results didn't show any need for a prefix.  So I took that out.

 

Note #2:  You don't really need a format at all.  If you removed the format entirely, you would get the report that you are seeking.

 

It looks like you are playing around with this, trying to understand better how it works.  So if you want to play around with the prefix, also try expanding the width of the format to cover 9999 instead of 999.  And try a non-blank prefix so you can easily tell when it is printing and when it is not.

rajeshalwayswel
Pyrite | Level 9
While using the you mentioned format prefix with "0" it starting how to remove it...I'm using prefix=' ' also it not working still it getting prefix '0'...
Patrick
Opal | Level 21

@rajeshalwayswel

For the sample data you've posted there isn't any need for a custom picture format to get your desired result. Is your sample data representative? Or why else do you see a need for a custom picture format?

data have;
  input a;
  format a best32.;
  cards;
1
33
556
1
;
run;

Capture.JPG

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
  • 3 replies
  • 901 views
  • 0 likes
  • 3 in conversation