, HI,
I will like to create a query using PROC SQL or a DATA Step and have SAS gave me an output dataset with only 10 records.
For example, I have a dataset named 'have' with 1 million records and I am running an certain functions ans if/then statements. I am limiting my output if certain conditions are met.
Can I limit processing based on the number of records present in the output dataset? When output dataset "want" has 10 observations then stop processing and output.
Thank you for your help;
I don't think there's a way to control the number of outobs in a data step.
You can use OBS= option, either globally through an option statement or as a dataset option to limit the input data size. If your if/then options don't elimininate observations or control output this should be fine.
You can use OUTOBS in SQL to limit the number of output obs.
If the purpose is testing for development, I tend to use the global OBS= option and then reset it when I'm done.
proc sql inobs=10;
select * from sashelp.class;
quit;
data class;
set sashelp.class(obs=10);
run;
You'll change the 5 to 10 for your purpose but this will work:
data have;
infile cards dsd;
input input;
cards;
1
2
3
4
5
6
7
8
9
10
;
options obs=5;
data want;
set have;
run;
proc sql outobs=5;
create table want2 as
select * from have;
I don't think there's a way to control the number of outobs in a data step.
You can use OBS= option, either globally through an option statement or as a dataset option to limit the input data size. If your if/then options don't elimininate observations or control output this should be fine.
You can use OUTOBS in SQL to limit the number of output obs.
If the purpose is testing for development, I tend to use the global OBS= option and then reset it when I'm done.
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.