BookmarkSubscribeRSS Feed
Chikku
Calcite | Level 5

Hi All,

I have a query with regards to the width(10) specified in the below format lines.

format income comma10.2;

format taxpaid dollar10.2;

format savings euro10.2;

We know that the length of numeric variables is 8.

Then what exactly is this width,i could not understand.we can keep any value for width or how exactly i can understand this.

Please let me know you thoughts.

Thank you:)

3 REPLIES 3
Tom
Super User Tom
Super User

Formats tell SAS how to display the value, not how to store it.  SAS only has two data types, floating point numbers and fixed length character strings.

So DOLLAR10.2 says to use 10 digits to display the value.

Try this little program.

data _null_;

  x=today();

  put x=

    / x= date9.

    / x= mmddyy10.

    / x= dollar10.2

    / x= time8.

  ;

run;

Fugue
Quartz | Level 8

To expand on what Tom is saying, the default length of a numeric variable is 8 bytes (not to be confused with 8 digits or 8 characters). The largest integer that SAS can store in a numeric variable with the default length of 8 (bytes) is 9,007,199,254,740,992.

Formats are just a way for SAS to display the stored numeric variable.

kuridisanjeev
Quartz | Level 8

HI,

Default length for a Char variables in SAS is 8 Charecter's.but where as default length for a numeric variable is 8 Bytes,Not 8 digits.which means Apprx One Byte can Accommodates two or more digits..

As said by Fugue,we can store max 16 digits in a numeric variable .again number of digits we can store  is vary from One OS to Other OS.

Length in BytesSignificant Digits
Retained
Largest Integer
Represented Exactly
338,192
462,097,152
58536,870,912
611137,438,953,472
71335,184,372,088,832
8159,007,199,254,740,992

Source :SASSupport.Com.

Thanks,

Sanjeev.K

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 3 replies
  • 970 views
  • 1 like
  • 4 in conversation