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

 

Time is running out to save with the early bird rate. Register by Friday, March 1 for just $695 - $100 off the standard rate.

 

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 

 

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