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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 3 replies
  • 535 views
  • 0 likes
  • 3 in conversation