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.
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 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.