proc sql ;
CREATE TABLE WORK AS
select *
from cecl.ar_model_v_20170630
where (firstobs = 100 obs = 200) & (first obs = 400 obs = 500) ;
quit;
With SQL:
proc sql;
CREATE TABLE WORK AS
select * from cecl.ar_model_v_20170630(firstobs=100 obs=200)
union all
select * from cecl.ar_model_v_20170630(firstobs=500 obs=600);
quit;
%let cecl =/sas/model/model_dev/enterprise_inputs/published_data/cecl/M201706;
libname cecl "&cecl";
proc sql ;
CREATE TABLE WORK AS
select *
from cecl.ar_model_v_20170630
where (firstobs = 100 obs = 200) & (first obs = 400 obs = 500) ;
quit;
like try to retrieve row number 100 to 200 and then 500 to 600 from same table
Try a data step instead. SQL doesn't have a good way to extract specific rows.
data want;
set have;
if 100 <= _n_ <=300 or 400 <= _n_ <= 900;
run;
@skamal12000 wrote:
%let cecl =/sas/model/model_dev/enterprise_inputs/published_data/cecl/M201706;
libname cecl "&cecl";
proc sql ;
CREATE TABLE WORK AS
select *
from cecl.ar_model_v_20170630
where (firstobs = 100 obs = 200) & (first obs = 400 obs = 500) ;
quit;
like try to retrieve row number 100 to 200 and then 500 to 600 from same table
With SQL:
proc sql;
CREATE TABLE WORK AS
select * from cecl.ar_model_v_20170630(firstobs=100 obs=200)
union all
select * from cecl.ar_model_v_20170630(firstobs=500 obs=600);
quit;
Thank you so much for your help. I am very new to SAS database.
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 how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.