BookmarkSubscribeRSS Feed
Ranjeeta
Pyrite | Level 9

DATA CVA1819Q2;
SET CVA.FY1819Q2_VOLUME
CVA.FY1819Q2_MC (IN=MC);

/* ADD LEADING 0 FOR PROCEDURES 1-9 IN ORDER TO SORT PROPERLY */
IF SUBSTR(PROCEDURE,2,1)='.' THEN PROCEDURE = '0'||PROCEDURE;

IF MC=1 THEN PROCEDURE='11. Mitral Clip';

RUN;

Can someone advise if the set statement is concatenating the 2 data sets ? also what is placing the in=mc marker doing in the set statement?

 

 

 

For the proc sql code below: what is outer union corr doing ?

 

 

PROC SQL;
CREATE VIEW CVA_MS_LHIN_VIEW AS
SELECT DISTINCT
WAITLISTENTRYID,
PROCEDURE,
PATIENTLHINNAME,
'LHIN' AS SORTORDER
FROM CVA1819Q2(WHERE=(MISSING(PATIENTLHINNAME)=0))
OUTER UNION CORR
SELECT DISTINCT
WAITLISTENTRYID,
PROCEDURE,
'Ontario' AS PATIENTLHINNAME,
'PROV' AS SORTORDER
FROM CVA1819Q2(WHERE=(MISSING(PATIENTLHINNAME)=0));
QUIT;

2 REPLIES 2
Reeza
Super User
SET concatenates or appends data set. IN=MC allows you to identify which records come from which data set in case you want to exercise conditional logic. You can see it used later, to set the procedure name for that file.

I'll leave the SQL explanation for someone else.
snoopy369
Barite | Level 11
OUTER UNION simply concatenates query results (similar to how the SET works in the data step). CORR tells SQL to match up column names (without CORR, it matches up columns one-by-one without looking at the names).

This is answered in detail here: https://documentation.sas.com/?docsetId=sqlproc&docsetTarget=n0vo2lglyrnexwn14emi8m0jqvrj.htm&docset...

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 572 views
  • 2 likes
  • 3 in conversation