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

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.

 

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
  • 783 views
  • 2 likes
  • 3 in conversation