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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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