BookmarkSubscribeRSS Feed
JasonNC
Quartz | Level 8

Hi,

If we have columns which are in sequence then how can we use it in select statement

For example

If i have id1-id24 then in proc sql how to use the sql statement

proc sql noprint;

create table test as

select id1-id24

from dummy;

quit;

i want to use some thing like that.Can any one let me know how can i use that in sql select statement.


3 REPLIES 3
art297
Opal | Level 21

proc sql noprint;

create table test as

select *

from dummy (keep=id1-id24);

quit;

JasonNC
Quartz | Level 8

Hi,

I am also having an inner join with other table and i am picking some other values as well in this table

instead of writing dumm1,dumm2,dumm3 i want to write like dumm1-dumm24 in sql.

proc sql

create table test as

select dumm1.info,dummy1.pro

dumm2.peter,dumm2.marta,dumm1-dumm24

from
dummy1 innre jon dummy2

on (dumm1=dumm2);

art297
Opal | Level 21

Your proc sql statement has too many errors and ambiguities to show a correct example, but you can use select * and then, on the 2nd from the bottom line, add (keep=) statements after each filename.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 1701 views
  • 0 likes
  • 2 in conversation