BookmarkSubscribeRSS Feed
fredbell
Fluorite | Level 6
Hello everyone!

What do i need to do to get it to return the results from B in every row not just the first for each?


PROC SQL;
CREATE TABLE TEST AS
SELECT A.DATE,A.DAY,A.HANDLED,A.LEVEL1DESC, P.UCL,P.LCL
FROM MEAN1 A FULL OUTER JOIN DAILY_MEAN P
ON A.LEVEL1DESC = P.LEVEL1DESC AND A.DAY = P.DAY

ORDER BY A.LEVEL1DESC, A.DATE;
QUIT;



fred

Message was edited by: fredbell Message was edited by: fredbell
3 REPLIES 3
Florent
Quartz | Level 8
Hello,

What if you replace your 'full outer join' by a 'cross join' ?

It gives the following query:

PROC SQL;
CREATE TABLE TEST AS
SELECT A.DATE,A.DAY,A.HANDLED,A.LEVEL1DESC, P.UCL,P.LCL
FROM MEAN1 A CROSS JOIN DAILY_MEAN P
ON A.LEVEL1DESC = P.LEVEL1DESC AND A.DAY = P.DAY

ORDER BY A.LEVEL1DESC, A.DATE;
QUIT;



Regards,
Florent
darrylovia
Quartz | Level 8
do you mean something like this where you have a big table and a "look-up" table witha single row and want to put the data from the single row table on the big table?

See the below example for using the SASHELP table SHOES which comes in every SAS installation


proc sql;
create table average_sales as
select mean(sales) as avg_sales format=dollar12.
from sashelp.shoes;

create table shoes_with_avg_sales as
select S.*, a.avg_sales
from sashelp.shoes S cross join average_sales a
;
quit;
fredbell
Fluorite | Level 6
Thanks for the input people, it turns out that it was because the day was a number type.

I was instructed to use the put(day) to transform it back to a text,

From text to sas data format then back to text, what a pain in the PUT.

Thanks

Fred

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!

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.

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