Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Programming
- /
- SAS Procedures
- /
- output out using proc means

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 11-29-2018 10:30 AM
(2168 views)

Hi all

I want to know what is wrong with this code, I'm quite sure this code is correct but it may be the issue because of the big sample size, I have 1.6 million observation. So, What is the best idea to solve this problem.

when I submit this code, after few minutes the system showing proc means not responding.

regards

Ibrahim

```
proc sort data = have;
by year month week;
run; quit;
proc means data = have;
by year month week;
output out = want sum(FATKG)= FAT_KG SUM(PROTKG)= PROT_KG SUM(MILKKG)= MILK_KG;
RUN; QUIT;
```

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

I think @Astounding hit the nail on the head there. If you don't specify NOPRINT or VAR it will analyze all numeric variables and put that in the results window - and that will take time. So adding NOPRINT & a VAR statement should speed things up a lot.

```
proc sort data = have;
by year month week;
run;
proc means data = have
```**NOPRINT**;
by year month week;
**var FATKG PROTKG MILKKG;**
output out = want sum(FATKG)= FAT_KG SUM(PROTKG)= PROT_KG SUM(MILKKG)= MILK_KG;
RUN;

@Astounding wrote:

It's not clear how many numeric variables exist in your data set. Without a VAR statement, the default is to compute statistics for every numeric variable. PROC MEANS might be "intelligent" enough to figure out that you only need statistics computed for 3 variables ... but it might not figure that out. You might fix the problem just by adding to PROC MEANS:

var fatkg protkg milkkg;

5 REPLIES 5

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

You may want to suppress the output though - use NOPRINT. Generating that type of output can take a lot of time. If it sorted fine though, I'd expect PROC MEANS to run fine. And 1.6 million rows should complete in under 5 minutes in my experience (SAS UE is still less than a minute for me).

If you have a lot of variables, you can try dropping the variables you don't need in a data set option to make it faster. Not sure if that helps but worth a shot.

If you have a lot of variables, you can try dropping the variables you don't need in a data set option to make it faster. Not sure if that helps but worth a shot.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

It's not clear how many numeric variables exist in your data set. Without a VAR statement, the default is to compute statistics for every numeric variable. PROC MEANS might be "intelligent" enough to figure out that you only need statistics computed for 3 variables ... but it might not figure that out. You might fix the problem just by adding to PROC MEANS:

var fatkg protkg milkkg;

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

I think @Astounding hit the nail on the head there. If you don't specify NOPRINT or VAR it will analyze all numeric variables and put that in the results window - and that will take time. So adding NOPRINT & a VAR statement should speed things up a lot.

```
proc sort data = have;
by year month week;
run;
proc means data = have
```**NOPRINT**;
by year month week;
**var FATKG PROTKG MILKKG;**
output out = want sum(FATKG)= FAT_KG SUM(PROTKG)= PROT_KG SUM(MILKKG)= MILK_KG;
RUN;

@Astounding wrote:

It's not clear how many numeric variables exist in your data set. Without a VAR statement, the default is to compute statistics for every numeric variable. PROC MEANS might be "intelligent" enough to figure out that you only need statistics computed for 3 variables ... but it might not figure that out. You might fix the problem just by adding to PROC MEANS:

var fatkg protkg milkkg;

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

I appreciate your help my SAS friends HAHAHAH, now everything is fine and I got what I'm looking for.

thank you very much again

Ibrahim

regards

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!

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.