BookmarkSubscribeRSS Feed
yudhishtirb
Calcite | Level 5

Hello Team,

 

I am just wondering what below step actually does

 

data strat.rep_raised_resolved;
set strat.rep_raised_resolved strat.rep_raised_resolvedtotal;
if portfolio = '' then portfolio="TOTAL";
run;

 

Is it merge or union or full outer join or something else ? Can we relate it with any PROC SQL ?

 

Please advice us here

 

Thanks In Advance

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

This isn't really a question.  You may want to learn SAS so you understand some of these basics.

For your code, it is doing two things:

1) it is setting the three datasets: strat.rep_raised_resolved strat.rep_raised_resolvedtotal, underneath each other starting from the left.  A bit like a union all statement in SQL, except that set expands the final dataset to incorperate all the variables found across the three datasets.

2) An if logic block decides if the variable portfolio is empty ('') and if so populates it with the string "TOTAL".

 

arodriguez
Lapis Lazuli | Level 10
Hi,

It is a "union all". The result dataset will contain all observation of both datasets.
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Just to add, its not quite a union all (unless by happenstance all datasets have the same structure).  Union all will fail if any of the datasets have more or less columns, and do implcit length alterations if needed.  Set will fail if datatypes are different for existing columns.

Loko
Barite | Level 11

Hello,

 

Just to add - union will also fail if datatypes are different for the same column

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 4 replies
  • 1282 views
  • 1 like
  • 4 in conversation