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

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.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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