BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
arodriguez
Lapis Lazuli | Level 10

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!

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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;

View solution in original post

4 REPLIES 4
Reeza
Super User

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. 

Tom
Super User Tom
Super User

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;
arodriguez
Lapis Lazuli | Level 10
Ok, thanks for the information. I will create a issue in SAS support and try to upgrade to data step the imports that give problems in SAS 9.4 and not in 9.3
arodriguez
Lapis Lazuli | Level 10
Hi,
I have spoke with support and seems to be an error with SAS 9.4. TS1M3, the same importation in M2 don't give any error. They say that may be solved on next version.

sas-innovate-2024.png

Today is the last day to save with the early bird rate! Register today for just $695 - $100 off the standard rate.

 

Plus, pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 2062 views
  • 0 likes
  • 3 in conversation