BookmarkSubscribeRSS Feed
TimA
Calcite | Level 5

Dear All,

Could you please explain the order and particulars in which SAS 'actions', based on the below query? - perhaps with examples. I am interested when the groupping is done, if it's done several times, when the 'distinct' takes place and what this keyword actually does - in this context, what kind of rows it removes, if it's before or after the groupping is done...

Thank you very much in advance!

PROC SQL;

CREATE TABLE WORK.TABLE1 AS

   SELECT DISTINCT t1.'Column1'n, (MAX(t1.Column2'n)) AS 'MAX Value'n,

            (CASE WHEN t1.'Column2'n = MAX(t1.'Column2'n) THEN t1.'Column3'n ELSE "" END) AS PL

    FROM WORK.TEST AS t1

    GROUP BY t1.'Column1'n;

QUIT;

1 REPLY 1
chang_y_chung_hotmail_com
Obsidian | Level 7

There is an undocumented option _method, which may give you some idea. Here is an example:


proc sql _method;
  select distinct name, max(age) as maxAge
  from   sashelp.class
  group by sex;
quit;
/* on log
NOTE: The query requires remerging summary statistics back with the original data.
NOTE: SQL execution methods chosen are:
      sqxslct
          sqxunqs
              sqxsumg
                  sqxsort
                      sqxsrc( SASHELP.CLASS )
*/

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 1 reply
  • 749 views
  • 0 likes
  • 2 in conversation