Hi everyone,
I'm testing some programs that we have to check if we can upgrade sas without many troubles. In a check that I was doing I notice that SAS 9.4 import different that SAS 9.3 with proc import. I have attatched the file (notice that it's in txt because communitie don't allow csv).
The code that I use to import in that case is
proc import datafile="XXXXXXX\example.csv"
out=example
dbms=csv
replace;
getnames=yes;
run;
In fact, with SAS 9.4 I get an error because sas try to put a date format into the data _NULL_.
Anyone know how to solve it without change importation to data _NULL_?
Thanks!
Raise the issue with SAS support. I suspect what is happening is that SAS 9.3 did not consider the value in the last row as a valid DATE format so it just reads the field as character. But 9.4 decides that you intended the field to be a date.
The real solution is to only used PROC IMPORT for quick and dirty looks at source files. Once you figure out what format your input files use then write you own data step to read it.
If you really have no idea what is in your file then just read everything as character and take a look yourself.
data sample ;
infile 'myfile' dsd truncover firstobs=2;
length var1-var20 $200 ;
input var1-var20;
run;
You don't have control with proc import. Unless you write your own data step you can't control the variable type from a text file.
You can try GuessingRows=1 but that might mess up other things.
Raise the issue with SAS support. I suspect what is happening is that SAS 9.3 did not consider the value in the last row as a valid DATE format so it just reads the field as character. But 9.4 decides that you intended the field to be a date.
The real solution is to only used PROC IMPORT for quick and dirty looks at source files. Once you figure out what format your input files use then write you own data step to read it.
If you really have no idea what is in your file then just read everything as character and take a look yourself.
data sample ;
infile 'myfile' dsd truncover firstobs=2;
length var1-var20 $200 ;
input var1-var20;
run;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.