BookmarkSubscribeRSS Feed
YannRC
Obsidian | Level 7

Hello, i work on Viya 4 with sas Studio and flow.

Before i work with SQL Query. It's very clear for me with SQL. You have ton possibilities :

 

LEFT JOIN Table2 on Table1.Var = Table2.var 

where varX .... and VarX.....

 

Or LEFT JOIN Table2 on Table1.Var = Table2.var and varX= .... and VarX=.....

 And the result of these 2 queries are not equal. 

 

In SAS STUDIO, i'ts easy for me to to the second one. But, for the first on, i don't manage to do it. Perhaps, i can use the expression generator but i don't know how to write it. 

Can you help me?

1 REPLY 1
Patrick
Opal | Level 21

Using a current Viya 4 release I could generate the following code:

PROC SQL;
   CREATE TABLE WORK.'result'n AS
   SELECT 
      t1.'Name'n,
      t1.Sex,
      t1.Age,
      t1.Height,
      t1.Weight
   FROM
      SASHELP.class t1
         INNER JOIN SASHELP.class t2 ON (t1.'Name'n = t2.'Name'n)
   WHERE
      UPPER(t2.Sex) = 'F'
   ;
QUIT;
RUN;

Here the flow:

Patrick_0-1704077896725.png

The where clause is based on the filter condition

Patrick_1-1704077967893.png

 

 

 

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 678 views
  • 0 likes
  • 2 in conversation