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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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