BookmarkSubscribeRSS Feed
thanikondharish
Calcite | Level 5

data ex1 ;
input group amount ;
cards ;
a 9848975
b 9457890
;
proc format ;
picture pic high-low='999,9999 -rs/-' ;
run;
data ex2 ;
set ex1 ;
format amount pic. ;
run;

 

if run above program it doesn't work can you give correct program

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Maxim 2 - Read the log.

https://communities.sas.com/t5/SAS-Communities-Library/Maxims-of-Maximally-Efficient-SAS-Programmers...

 

 

proc format;
  picture pic
    low-high='999,9999 -rs/-';
run;

Please use the code window, it is the {i} above post area, to post code, and please mark answered questions as answered.

ballardw
Super User

Format ranges ALWAYS go from smaller to larger

 

Also, you might want to test your format with some other values to see if it does what you intend.

data ex1 ;
input group $ amount ;
cards ;
a 9848975
b 9457890
c 1234567898
d 123
;
proc format library=work ;
picture pic low-high='999,9999 -rs/-' ;
run;
data ex2 ;
set ex1 ;
format amount pic. ;
run;

See if the results for group c and d match expectation.

 

PS you forgot the $ in your input statement so your example data has a missing group numeric value.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 711 views
  • 0 likes
  • 3 in conversation