BookmarkSubscribeRSS Feed
Uli
Calcite | Level 5 Uli
Calcite | Level 5
Dear All,

Please help me out the following issue.
Input:

data a;
input a ;
datalines;
9
34
45
64
;

output;

9.00
34.0
45.0
64.0

I can convert the data using put function to character (ex: put(a,8.1);
or i can display the value with format 8.1;

I just want to store the value with decimal value Zero to the integers ( i.e 34 to 34.0)


Could you please suggest me is ther any other way to solve this issue.

Thanks In Advance.



Please help me out
4 REPLIES 4
Patrick
Opal | Level 21
Hi

SAS knows only 2 data types: character or numeric. There is no integer data type.

But you can always store a format like 8.1 permanent for a variable - so it will show 34.0 by "default".

HTH
Patrick
Uli
Calcite | Level 5 Uli
Calcite | Level 5
Dear Patrick.

Thanks for your response.

How can i convert numeric value 34 to 34.0 and stores into numeric variable.

Thanks IN Advance.
DBailey
Lapis Lazuli | Level 10
From SAS' perspective, there is no difference between 34 and 34.0 except for the display format. The underlying data are the same.

If you want to change the format, then you can do so but it makes zero difference with the actual data.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
More specific to the point, review the use of the SAS FORMAT and/or ATTRIB statement which is used to associate an "output display format" with a SAS variable.

There are both SAS-system standard formats documented in the SAS Language Dictionary and also there is the SAS PROC FORMAT (procedure) where you can develop / define your own format.

Scott Barry

Suggested Google advanced search arguments, this topic / post:

display numeric variable integer decimal site:sas.com

format documentation site:sas.com

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
  • 4 replies
  • 13384 views
  • 0 likes
  • 4 in conversation