BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Anne_A
Quartz | Level 8

Dear Community,

I would like to use the SIZEKMG. format (quite obviously to show file sizes) but I seem to encounter a limitation: when the value becomes "bigger" (example attached) the shown value (both when opening the dataset and when generating a report) is made of * only.

Any hint?

Many thanks in advance

Anne.

data have;
 format size sizekmg22.;
 input size;
cards4;
5744099328
1785724928
28157399040
1741762461696
17674880794624
;;;;
run;

SIZEKMG.jpg

1 ACCEPTED SOLUTION

Accepted Solutions
ErikLund_Jensen
Rhodochrosite | Level 12

Hi @Anne_A 

 

I ran into the same problem, so I made this custom format:

 

proc format library=library;
	picture sizekmgt (round default=8)
	low - 1023 = '0009 bt'
	1024 - 1048575 = '009.9 KB' (mult = %sysevalf(10/1024))
	1048576 - 1073741823 = '009.9 MB' (mult = %sysevalf(10/1048576))
	1073741824 - 1099511627775 = '009.9 GB' (mult = %sysevalf(10/1073741824))
	1099511627776 - high = '009.9 TB' (mult = %sysevalf(10/1099511627776))
	;
run;

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

Generally, the first step I would recommend in situations like this is to check the documentation.

 

SIZEKMG FORMAT

 

 

--
Paige Miller
Anne_A
Quartz | Level 8

Hi @PaigeMiller ,

Actually I had checked the documentation. Your comment seems to imply I should find relevant info in there, but even after looking again I don't see any. Is there anything I should have noticed?

ErikLund_Jensen
Rhodochrosite | Level 12

Hi @Anne_A 

 

I ran into the same problem, so I made this custom format:

 

proc format library=library;
	picture sizekmgt (round default=8)
	low - 1023 = '0009 bt'
	1024 - 1048575 = '009.9 KB' (mult = %sysevalf(10/1024))
	1048576 - 1073741823 = '009.9 MB' (mult = %sysevalf(10/1048576))
	1073741824 - 1099511627775 = '009.9 GB' (mult = %sysevalf(10/1073741824))
	1099511627776 - high = '009.9 TB' (mult = %sysevalf(10/1099511627776))
	;
run;
Anne_A
Quartz | Level 8

Awesome! Thank you so much @ErikLund_Jensen 😊!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 4 replies
  • 1243 views
  • 3 likes
  • 3 in conversation