Help using Base SAS procedures

Picture Formats

Reply
Frequent Contributor
Posts: 91

Picture Formats

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

 

 

 

Super User
Posts: 6,785

Re: Picture Formats

[ Edited ]
Posted in reply to rajeshalwayswel

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.

Frequent Contributor
Posts: 91

Re: Picture Formats

Posted in reply to Astounding
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'...
Respected Advisor
Posts: 4,736

Re: Picture Formats

Posted in reply to rajeshalwayswel

@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

Ask a Question
Discussion stats
  • 3 replies
  • 196 views
  • 0 likes
  • 3 in conversation