BookmarkSubscribeRSS Feed
Ivan555
Quartz | Level 8

Hello!

 

This may be a common task, but I cannot find a better way to solve it.

When importing to SAS from Excel, in the numeric fields I get the '.' values  if in Excel cells I have blanks.

Could you please tell in case of fields having blanks if it is possible to get  '0'  values instead of '.' during import? 

 

Thanks!

6 REPLIES 6
PaigeMiller
Diamond | Level 26
options missing=0;
--
Paige Miller
Reeza
Super User
Yeah, this isn't a common task and replacing missing with 0 can be dangerous and not valid in many circumstances so it's handled by a one off solution.

Is it many variables? PaigeMillers solution will change how it appears but not necessarily how it's handled. If you were doing an average calculation, would you want 0's included in the average and count or not?
PaigeMiller
Diamond | Level 26

I can't think of a situation where you would want missings to be considered a zero for data analysis purposes. I think it makes sense to handle them as missing, even if it shows as a zero, which is what OPTIONS MISSING=0; does.

 

The drawback to OPTIONS MISSING=0; is that every missing in the entire data set (and all other data sets) will appear as zero until you turn the option back to OPTIONS MISSING=.; There is no way to limit this to just a single data set or to certain columns in a data set.

 

 

--
Paige Miller
Reeza
Super User
Neither can I, but I suspect the OP doesn't know the difference between a number appearing as 0 and still being missing as the underlying value.
PaigeMiller
Diamond | Level 26

@Reeza wrote:
Neither can I, but I suspect the OP doesn't know the difference between a number appearing as 0 and still being missing as the underlying value.

I seem to recall that if you go back 20 years, Excel didn't know the difference between 0 and missing; and all missings were treated as zeros , giving you incorrect averages and so on. (But that has been fixed)

--
Paige Miller
Reeza
Super User
Excel also gave you negative standard deviations at one point 🙂

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 6 replies
  • 802 views
  • 0 likes
  • 3 in conversation