BookmarkSubscribeRSS Feed
knveraraju91
Barite | Level 11

Dear,

 

Some body had written a proc sql code in a macro

 

porc sql;

select distinct
obs.*,

What is "obs.*". I know '*' means all. Does it mean all observations. Please suggest any example i can read. Thank you.

 

2 REPLIES 2
SASKiwi
PROC Star

Where is the rest of your query? "obs" is a short way of identifying a table if your query looks like this:

 

proc sql;
  create table want as
  select obs.*
  from MyLongTableName as obs
  ;
quit;

So the query means select all columns from the table referenced by "obs". BTW "obs" has no special meaning. You can use any character or characters to reference the table: ABC, XYZ etc.

PGStats
Opal | Level 21

As @SASKiwi said, obs could be a table alias name or it could be the table name itself, as in the query:

 

proc sql;
select 
    obs.*,
    have.age
from obs, have
where obs.id=have.id;
quit;
PG

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