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.
Thank you,
Rajasekhar
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.
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.
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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.