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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.