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 open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.