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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 672 views
  • 3 likes
  • 3 in conversation