Stuck on a SAS Problem? Ask for Help

Have you ever been in a situation where you know what you want SAS to do, but you can not quite figure out how? I sure have. Luckily, there is help out there and plenty of experienced SAS users who are willing to guide you. That is why I devote this blog post to one of my favorite sources of knowledge: the SAS online communities.

The SAS Programming Communities

First off, if you do not already have a profile at SAS, create one at the SAS Online Communities Home Page. Now you are ready to dive into the many different communities. Since I like Base SAS, Statistics, ODS Graphing and the IML language, I primarily use the following communities:

Use the drop down menu “Find a Community” at the front page to browse the different communities and find the ones you like the most.

SAS Online Communities

Posting a Question in the Communities

Now, you have created a profile and probably found the communities that fit your interests. Next comes finding the answer to your programming question. But before you actually post a question, think about this: If you have this problem, perhaps someone else have also had it. Consequently, someone else may have already asked a similar question on the SAS community. Therefore, use the search tools in the communities to find threads related to your problem before posting a question.

Next comes actually posting a question. You do this from the Post A Question site or at the individual community. But beware! There are a few rules you must follow to get the right answer. To get the right answer, you must ask the right question. Below I describe How To and How Not to ask a question in the communities.

The Bad Question

When you post a question at the communities, you should at least have some idea of what you want to do. And you should have spent some time yourself to see if you can figure it out yourself. Most solutions to a SAS problem start at Consequently do not post questions like “How to replace missing values with group means?” or “I want to calculate a moving average, how do I do this?”. Because these questions imply that you have not even given it a try yourself. You are just too lazy, so you want someone else to do the work for you.

And needless to say: Never ever post your homework at an online community and expect someone else to do it.

The Good Question

Next let us look at how to post a good question at the communities. The good question at the communities generally involve three things:

  • A clear, short description of your problem and what you have tried so far.
  • Example data, preferably in the form of a data step.
  • An overview of what your desired output or resulting data set looks like.

This means that instead of asking the question “How to replace missing values with group means?”, you should ask like this:

I have the following data with a group variable ID, and three numeric variables var1-var3. The three numeric variables contain missing values. I want to replace these missing values with the mean of the relevant variable for the relevant group. For example the mean of the non-missing values for var1 for ID=’1′ is 3, so I want the missing values for var1 for ID group 1 to be three instead of missing.

data have;
input ID$ var1 var2 var3;
1 . 3 4 
1 4 . 2 
1 . . . 
1 2 8 .
2 2 0 . 
2 5 . 1 
2 . 4 . 
3 . . 3
3 5 . 7 
3 3 1 7 
3 . . 2 
3 3 . 7
3 . 1 9 

This means that my desired data set look like this

data want;
input ID$ var1 var2 var3;
1 3 3 4 
1 4 5.5 2 
1 3 5.5 
1 2 8 3
2 2 0 3 
2 5 2 1 
2 3.5 4 1
3 3.6667 1 3
3 5 1 7 
3 3 1 7 
3 3.6667 1 2 
3 3 1 7
3 3.6667 1 9 

I have searched the internet extensively, but I feel stuck on this problem. Thank you in advance.

This is a much better way to ask a question. Because this gives the contributors something to work with. Furthermore it implies that you have actually given it a try yourself.

Finally, it is good practice to throw a bone to the contributors in the communities in the form of a like and a thank you. Also, remember to mark solved problems as a solution. This helps other users navigate the forums.


While I like the official SAS community the most, there are alternatives, such as and more general code forums as and These are all great alternatives to the official SAS Community.

The SAS online communities are a great way of gaining SAS knowledge. Check out my Learn SAS Programming site for other methods.