BookmarkSubscribeRSS Feed
☑ This topic is solved. 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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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