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.)
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.