BookmarkSubscribeRSS Feed
Shrutibhatnagar
Obsidian | Level 7

Hello 

i have smb1 dataset which has 3 different AGE OF NETWORKS for 3 different years 

i want to select only the MAXIMUM AON  using proc sql and also use this maximum AGE OF NETWORKS against the Product id 

as 3  different AGES are not possible .  how to create the data set for  age of network along one id .

 

5 REPLIES 5
PaigeMiller
Diamond | Level 26

Please show us a representative portion of the data that you are working on. Please show us the output you desire from the representative portion of your data.

 

Please go back and edit the title to something a little more descriptive of the problem.

 

 

--
Paige Miller
Shrutibhatnagar
Obsidian | Level 7

hello same has been edited !!

Kurt_Bremser
Super User

You added a spreadsheet, not a dataset. The proper method for posting SAS datasets is data steps with datalines.

A re-import of a spreadsheet is close to 100% sure to be different from the original dataset.

Shrutibhatnagar
Obsidian | Level 7

proc sql;
select distinct Max(AON ) AS Maximum_of_AON,smb.product_id
from class1.smb as Actual_AON
group by product_id
having AON=max(AON);
quit;

 

which gives :

Maximum_of_AON PRODUCT_ID

1281114832053

 

which is not the required result i want maximum of AON for all product id's 

PGStats
Opal | Level 21

You seem to need:

 

proc sql;
select 
    AON AS Maximum_of_AON,
    product_id
from class1.smb
group by product_id
having AON=max(AON);
quit;
PG

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 5 replies
  • 918 views
  • 0 likes
  • 4 in conversation