Hi,
I have a data set regarding road fatalities. Here is an example of my data set:
crash_id, bus_involvement
1, yes
2, no
3, -9
4, no
5, no
6, yes
Could you please let me know what does it mean ‘-9’ under crash_id 3? Is it unknown or missed data? If it is then how I will fix the issue before calculation?
Looking for your kind response.
I would imagine you should ask the person who created the data. We don't know why -9 shows up there.
Since you did not post your data as recommended (data step with datalines), we have no idea what it really contains.
It might even be that bus_involvement is numeric, with a format that displays 0 as no and 1 as yes. Since -9 is not covered by the format, it is displayed as is.
Anyway, the meaning of -9 should be defined in the documentation for the data you received. You got none? Request it.
It appears the entry of a -9 for bus involvement was a decision made by those who provided the data to you. We could guess what it means, but we can't read their minds. Ask them.
As a technical note, you are reading the -9 as a string value, producing bus_involvement="-9". A SAS procedure like proc freq will treat "-9" as a valid value. For character variables, only a blank is treated as missing. If you learn from your data source that the -9 is intended to represent a missing value, you could reassign "-9" to a blank. But before doing so, I would check to see if there are any records in which bus_involvement is already blank. If so, and if blank really means something different than -9, then you might want to leave bus_involvement unchanged and make a new variable bus_involvement2 from it, which you can modify without losing the original information.
@Uddin wrote:
Hi,
Thank you so much for your kind response. I checked the whole dataset, and couldn't find any blank under bus_involvement variable. Then do you think I can make it missing or blank? Looking for your kind response. Kind Regards
What is the benefit of converting -9 to a blank? I see none.
But you've missed the point. Until you know what -9 means, converting it to something else may not be a good thing to do. Please go find out what -9 means.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.