BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Karen_sas11
Calcite | Level 5
proc sql;
create table total2 as
select idnumber, jobcode, sale1, sale2, sum(sale1) as s1, sum(sale2) as s2,
           sum(sale1, sale2) as s3
 from sumy
 group by jobcode;
 quit;

Capture.PNG

 

Hello , is anybody can tell me about the order of observations in each group  without having clause and order by clause when group by clause?

In the attachment and code, the table total is the original data, after using groupy by clause, the entire data is grouped by jobcode shown in table total2. However, I found the order of observations in each group is werid. I assume the order should be sequencial as the original data, but is wasn't.

Order by clause can modify the order in each group, if there is no order by clause, what's the order convention in  each group, which is my concern.

Hope anyone can explain it for me.

Many thanks!

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

It's undetermined, and an effect of the order in which observations are read from the utility file when the output is written.

Always specify the order yourself if you need a specific one.

View solution in original post

2 REPLIES 2
Kurt_Bremser
Super User

It's undetermined, and an effect of the order in which observations are read from the utility file when the output is written.

Always specify the order yourself if you need a specific one.

Karen_sas11
Calcite | Level 5

Thank you Kurt, now I get it.

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
  • 2 replies
  • 685 views
  • 0 likes
  • 2 in conversation