02-25-2016 01:15 PM
Hi I need help for the following question.
Raw data Variable HOUR values are:
My code: VSTPTNUM=HOUR;
But the data got from vendor shows results:
How did the vendor data shows more digits after decimal than my results. please help in my code. Thank you.
02-25-2016 02:07 PM - edited 02-25-2016 02:08 PM
I believe this is an issue in numerical precision and how your data is stored within a computer. You can google the term to find many questions and the responses for dealing with this.
I guess my question is what do you want for an output? Also, did you specify informats/formats and you don't show how the vendor recevied/imported the number. Currently there's too many unknowns to comment beyond the above statement.
02-25-2016 02:29 PM - edited 02-25-2016 02:35 PM
All of these numbers are different, both mathematically and for SAS. The latter is shown by the code below:
data test; input hour; cards; 23.67 -22.48 -1.33 23.666666 -22.4833333 -1.3333333 23.666666667 -22.48333333 -1.333333333 ; proc sort data=test nodupkey; by hour; run; proc print data=test; format hour best12.; run;
So, if the "raw data" were e.g. 23.67 and you obtained 23.666666, then the raw data must have been rounded. Similarly, the vendor's values could be truncated to fewer decimals to match your results.
When working with numeric variables in SAS you should always distinguish between
What file format are the raw data and how did you import them into SAS?
What file format are the vendor's data?
03-03-2016 02:05 PM
A real crude guess: the original data you looked at was in Excel and set to display 2 decimals even though more were present. And then the data was imported to SAS using Proc import which ignores Excel decimal setting.