I want to add an option/statement to this step so that only the first 10 obs are imported.
proc import data=map_export datafile="G:\Departments\Research\MAP\1112\Oconee - &admin. - Clean.txt" dbms=dlm replace;
delimiter='09'x;
run;
There is no procedure specific option to directly limit the quantity the IMPORT procedure will read in, to my knowledge. You can use the OBS= system option to limit the number of records that SAS will process. Setting OBS=10 will limit the processing to the first 10, then set it back to OBS=MAX so subsequent operations consider the full data.
options obs=10;
proc import
datafile="G:\Departments\Research\MAP\1112\Oconee - &admin. - Clean.txt"
out=map_export
dbms=dlm
replace;
delimiter='09'x;
run;
options obs=max;
Since this is a text file, you should also consider using the DATA step with an INFILE statement to read the data. It requires more knowledge of the data fields as you read them, but that approach provides much more control over how much data is read in. See this topic for more guidance and troubleshooting.
(Editor's note: modified this reply for clarification and more detail on this popular topic.)
There is no procedure specific option to directly limit the quantity the IMPORT procedure will read in, to my knowledge. You can use the OBS= system option to limit the number of records that SAS will process. Setting OBS=10 will limit the processing to the first 10, then set it back to OBS=MAX so subsequent operations consider the full data.
options obs=10;
proc import
datafile="G:\Departments\Research\MAP\1112\Oconee - &admin. - Clean.txt"
out=map_export
dbms=dlm
replace;
delimiter='09'x;
run;
options obs=max;
Since this is a text file, you should also consider using the DATA step with an INFILE statement to read the data. It requires more knowledge of the data fields as you read them, but that approach provides much more control over how much data is read in. See this topic for more guidance and troubleshooting.
(Editor's note: modified this reply for clarification and more detail on this popular topic.)
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.