BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
raja777pharma
Fluorite | Level 6

Hi Team,

 

I have written below code by using proc sql to get maximum value by group values.

 

proc sql;
create table max_lengths_ds as
select max(var_length) as max_length
          ,dataset,variable,label,source_var
from input
group by dataset,varible,lable;
quit;

But i am gettting below Note , i am not understand why this note is coming and how to remove.

 

raja777pharma_0-1646116426067.png

 

Thank you,

Rajasekhar

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
2 REPLIES 2
Kurt_Bremser
Super User

You have a variable (source_var) in your SELECT that is neither the subject of a summary function nor part of the GROUP BY clause. Either remove it from the SELECT, or add it to the GROUP BY.

japelin
Rhodochrosite | Level 12

I think it is because the number of rows generated from the following two sql is different.
Try to run it by adding source_var to group by.

 

proc sql;
create table max_lengths_ds_1 as
select max(var_length) as max_length
from input
group by dataset,varible,lable;
quit;

proc sql;
create table max_lengths_ds_2 as
select dataset,variable,label,source_var
from input
group by dataset,varible,lable;
quit;

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1202 views
  • 1 like
  • 3 in conversation