Hi all
I just want to know how to remove or create a missing value for this kind of numbers (115846255E5), numbers that have letters that resulted from some calculations.
regards
Ibrahim
@Barkamih wrote:
I'm looking only for a number less than 1000, so when i did that these numbers still in my dataset by using the following code:
If PDY > 1000 then PDY = 0;
Are you saying that PDY=115846255E5 was not changed to 0 by your IF-THEN statement? If so, please post test data demonstrating this in the form of a DATA step and also your code. (Note that invalid numeric raw data values such as 1234K5 typically lead to numeric missing values, which are indeed evaluated as < 1000 in comparisons.)
Also, why would you change an "invalid" value (according to your definition) to an arbitrary valid value (0 is "a number less than 1000"), which has the potential to ruin subsequent analyses? I'd rather suggest to replace these exceedingly large values by a special missing value, e.g. .E, if this makes sense:
if PDY>1000 then PDY=.E;
Hi @Barkamih,
As a numeric literal, 115846255E5=11584625500000. If this is the value of a numeric variable, it depends on the (arbitrary) choice of the display format if the formatted value contains a letter ("E"). So, without specifying a format your criterion "numbers that have letters" is not well-defined because numeric values as such don't contain letters. Also, you should have a good reason to remove a (possibly) valid numeric value (such as 11584625500000) from your data, in particular if it resulted from a calculation.
thanks for this,
Yes I have a reason to remove them,
I'm looking only for a number less than 1000, so when i did that these numbers still in my dataset by using the following code:
If PDY > 1000 then PDY = 0;
@Barkamih wrote:
I'm looking only for a number less than 1000, so when i did that these numbers still in my dataset by using the following code:
If PDY > 1000 then PDY = 0;
Are you saying that PDY=115846255E5 was not changed to 0 by your IF-THEN statement? If so, please post test data demonstrating this in the form of a DATA step and also your code. (Note that invalid numeric raw data values such as 1234K5 typically lead to numeric missing values, which are indeed evaluated as < 1000 in comparisons.)
Also, why would you change an "invalid" value (according to your definition) to an arbitrary valid value (0 is "a number less than 1000"), which has the potential to ruin subsequent analyses? I'd rather suggest to replace these exceedingly large values by a special missing value, e.g. .E, if this makes sense:
if PDY>1000 then PDY=.E;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.