I used proc import to import data from csv file. For some long numeric columns ( for ex, 456789123), csv shows scientific notation(for ex, 4.20E+8). So when SAS reads in CSV, it is converted to 400000000 (instead of the original, correct number = 456789123). I want to add a data quality checking step to alert myself that CSV actually is a scientific notation. How can I have SAS show that column as 4.20E+8 (that way, I will be able to pop up an error message for myself)?
proc import datafile = "inputfile.csv"
out = outds
dbms = csv replace;
getnames = YES;
run;
Whenever importing data gets complicated (read: ALWAYS), do not use proc import, but write your own data step. In that, you can read this column into a temporary character variable, check for the notation, and then either convert to the final numeric variable (if no scientific notation) or set a flag.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.