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;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.