BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
skamal12000
Calcite | Level 5

proc sql ;

CREATE TABLE WORK AS

select *

from cecl.ar_model_v_20170630

where (firstobs = 100 obs = 200) & (first obs = 400 obs = 500) ;

quit;

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

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;
PG

View solution in original post

5 REPLIES 5
skamal12000
Calcite | Level 5

%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

Reeza
Super User

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



 

Reeza
Super User
Please do not post the same question multiple times.
PGStats
Opal | Level 21

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;
PG
skamal12000
Calcite | Level 5

Thank you so much for your help. I am very new to SAS database.

SAS Innovate 2025: Register Now

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!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1055 views
  • 2 likes
  • 3 in conversation