BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
tianerhu
Pyrite | Level 9
libname apple 'C:\SAS data and program\data\data from web source\Geo-targeting\Data Files';
data apple.computers;
infile 'C:\SAS data and program\data\data from web source\Geo-targeting\Data Files\computers.csv' dsd firstobs=2;
input configuration screen_size battery_hours ram processor_speed SSD $ HD_size $;
run;

********************************************************************************************
proc import datafile = "C:\SAS data and program\data\data from web source\Geo-targeting\Data Files\test file.csv"
 out = test
 dbms = CSV
 replace
 ;
run;

The two code above can both transfer data from raw file into sas data set. what is their difference?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

After you run PROC IMPORT, look at the log. You will see the SAS code that was generated by PROC IMPORT. This is the best way to see how the PROC IMPORT statement is similar to and different from the DATA step.

 

In general, PROC IMPORT is a more friendly way to import data because you don't have to know as much about the data that you are reading. When you write a DATA step, you need to know in advance how the data are structured. PROC IMPORT makes intelligent guesses to try to simplify the process.

View solution in original post

3 REPLIES 3
Rick_SAS
SAS Super FREQ

After you run PROC IMPORT, look at the log. You will see the SAS code that was generated by PROC IMPORT. This is the best way to see how the PROC IMPORT statement is similar to and different from the DATA step.

 

In general, PROC IMPORT is a more friendly way to import data because you don't have to know as much about the data that you are reading. When you write a DATA step, you need to know in advance how the data are structured. PROC IMPORT makes intelligent guesses to try to simplify the process.

tianerhu
Pyrite | Level 9

Got it . Thank you for your help.

Tom
Super User Tom
Super User

PROC IMPORT will guess how to define/read the variables from the file.

 

If you write your own data step instead you have full control.

 

With your own data step you can determine how the variables are named, what type they are, what storage length they use, how the text in the CSV file is converted into values in the dataset, what (if any) formats are permanently attached to the variables to control how the values are displayed, what labels are attached to the variables, etc.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 3 replies
  • 582 views
  • 0 likes
  • 3 in conversation