By Francis

2018-03-13 15:05:10 8 Comments

What is the difference between import a large csv file into SAS by code and using the import wizard (point and click)? Will the data imported in SAS be different?


@Reeza 2018-03-13 16:05:31

It depends. There are several ways to import a file:

  1. Using GUI task in EG, SAS Studio or Base
  3. Data step code which manually specifies the fields and types.

The third is the most accurate because you've explicitly specified things. If you do the same in the EG task your data will be the same. However, if you don't modify the automatic settings you'll get something more similar to PROC IMPORT.

PROC IMPORT guesses at types and lengths so it may not be correct.

Basically, there is no guarantee that the results of any of these methods will be the exact same depending on what options you pick.

The most accurate is the data step, followed by EG task where you customize each format/type and then PROC IMPORT with GUESSINGROWS=MAX option. This option forces SAS to scan the entire file before picking lengths and types so it's more likely to be accurate.

@Francis 2018-03-14 11:24:44

Thanks Reeza. Could you give me an example of importing a csv file into SAS by Data step code please? @Reeza

@Francis 2018-03-14 11:31:58

Beside, do I need more code to ensure the accuracy of imported date if the csv file is large? 2018-03-13 15:56:13

The difference is your comfort with either method. As @Joe answered, the Import Data wizard writes SAS code. Thus, it has all of the options available to it which are available in the PROC IMPORT.

The structure of the data imported, relative to its original structure in the CSV file solely depends on the options you chose to use in either import method. Short Answer: The data will be the same.

@Joe 2018-03-13 15:30:21

The Import Data wizard is a code-writer, so it actually writes SAS code to perform the input. As such, it is no different than writing your own PROC IMPORT step, except that it has certain defaults.

You can check an option to ask it to write the code it produces to the log; that is often what I use the point and click interface for, to write the code partially, and then I update specifics it doesn't handle properly.

Related Questions

Sponsored Content

17 Answered Questions

[SOLVED] How to import CSV file to MySQL table

24 Answered Questions

[SOLVED] Is it possible to force Excel recognize UTF-8 CSV files automatically?

  • 2011-05-14 13:53:39
  • Lyubomyr Shaydariv
  • 401631 View
  • 340 Score
  • 24 Answer
  • Tags:   excel csv utf-8

20 Answered Questions

[SOLVED] Create a CSV File for a user in PHP

16 Answered Questions

[SOLVED] Save PL/pgSQL output from PostgreSQL to a CSV file

13 Answered Questions

[SOLVED] How to import CSV file data into a PostgreSQL table?

7 Answered Questions

[SOLVED] Pandas writing dataframe to CSV file

36 Answered Questions

[SOLVED] Excel to CSV with UTF8 encoding

11 Answered Questions

[SOLVED] Ruby on Rails - Import Data from a CSV file

8 Answered Questions

[SOLVED] Import CSV file into SQL Server

22 Answered Questions

[SOLVED] Microsoft Excel mangles Diacritics in .csv files?

Sponsored Content