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

sas-innovate-2024.png

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.

 

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
  • 785 views
  • 1 like
  • 3 in conversation