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.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.