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
Opal | Level 21

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

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 722 views
  • 0 likes
  • 3 in conversation