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

Hi everyone,

 

I am new to SAS studio (3.4) and having some issues understanding how to use proc means for several data sets or if this is possible.

 

I have 5 SAS data sets in my library (different years of data for the same variables).

 

I want to conduct proc means for a few continuous variables for each data set and output it in a way that shows each variable's descriptive stats (N, Mean, Median, 10th and 90th percentile, max, min) by year (each data set). 

 

Any advice would be much appreciated. 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Concatenate the 5 datasets into one, using PROC APPEND, or a datastep.

 

Then run PROC MEANS using the BY statement to create analyses for each year.

 

In the future, do not break these data sets up by years, keep them together.

 

 

--
Paige Miller

View solution in original post

5 REPLIES 5
PaigeMiller
Diamond | Level 26

Concatenate the 5 datasets into one, using PROC APPEND, or a datastep.

 

Then run PROC MEANS using the BY statement to create analyses for each year.

 

In the future, do not break these data sets up by years, keep them together.

 

 

--
Paige Miller
kthartma
Fluorite | Level 6
Thank you for the guidance!
Reeza
Super User

@kthartma wrote:

Hi everyone,

 

I am new to SAS studio (3.4) and having some issues understanding how to use proc means for several data sets or if this is possible.

 

I have 5 SAS data sets in my library (different years of data for the same variables).

 

I want to conduct proc means for a few continuous variables for each data set and output it in a way that shows each variable's descriptive stats (N, Mean, Median, 10th and 90th percentile, max, min) by year (each data set). 

 

Any advice would be much appreciated. 


It's not good design to keep your data separated like that. The suggestion to combine the data is correct and then you can run PROC MEANS with a CLASS or BY statement to summarize it. 

 

Here are some examples:

 

https://github.com/statgeek/SAS-Tutorials/blob/master/proc_means_basic.sas

 

http://video.sas.com/detail/videos/sas-analytics-u/video/3306906230001/summary-statistics-using-sas-...

kthartma
Fluorite | Level 6
Thank you for the insight and links!
cheenaChuks
Obsidian | Level 7

How would you use a class statement for two datasets? Please could you include a short example. I looked at the links but there were only examples with the by statement.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 4181 views
  • 4 likes
  • 4 in conversation