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?
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.
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.
Got it . Thank you for your help.
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.
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!
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.
Ready to level-up your skills? Choose your own adventure.