BookmarkSubscribeRSS Feed
piaans
Calcite | Level 5

Hi

I try to import a CSV file with the following code

proc import data file = "& data directory. \ c_can.csv"
      out = cardiacancer
      dbms = csv
      replace;
      getnames = yes;
      DataRow = 2;
      guessingrows = 5000;

run;

When I do it in sas9.1 I get the following
NOTE: The data set WORK.CARDIACANCER has 5141 observations and 82 variables.

When I run it in sas9.3 I get the following
NOTE: The data set WORK.CARDIACANCER has 5141 observations and 65 variables.

why this difference in variables?
I need to run the code in sas9.3, since the code is part of a program that uses the functionality only in sas9.3

In addition, I find that the sas9.3 not load the entire variable length

4 REPLIES 4
Doc_Duke
Rhodochrosite | Level 12

You've got some sort of length setting that is different between the two versions.  Each version has its own configuration files and I bet they are different.  The easiest way to find the difference might be to run PROC OPTIONS; in each.  The LRECL default in PROC IMPORT; may be different.

piaans
Calcite | Level 5

The lrecl is 32767 in both sas9.1 and sas9.3

ballardw
Super User

I basically use Proc Import to generate a base datastep to read CSV files. Look in the log to see the generated code to see the details of how the file was read in each version.

I then save the starting code, modify it as I need specifying informats, formats, lengths, labels and such. Then I'm not getting different behaviors, especially for lengths of character variables, for different versions of the input data set OR across SAS versions.

piaans
Calcite | Level 5

It is also the solution I've used so far. but there are occasionally new variable to CSV files, and it's a little inconvenient to have to fix the code to, instead of being able to use a proc import

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1282 views
  • 1 like
  • 3 in conversation