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
- /
- PROC GENMOD BAYES - getting kernel values and densities

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 12-20-2017 11:03 AM
(903 views)

Yesterday I was attempting to score my source dataset in a PROC GENMOD, DIST = NORMAL model that also used the BAYES statement, see this thread:

With help I figured out how to do it a couple of different ways. Though along the way, at some point, I ran the code and it generated some datasets for all model parameters and those files included the parameter estimate's Kernel values and Densities. I have no idea how I created these datasets (one for every model parameter), since I was trying out a bunch of different code options when trying to address my "scoring" question. I also don't have the outputted files any more, but they were in my SAS 'work.' folder and had the following naming strategy and included fields called "lag...", "interation...", etc.:

'_doctmp000000000000000000019'

The 19 in the file name represented the number of the file, since there were multiple parameters and the file names were interative. I have been trying to retrace my footstep for about an hour to no avail.

In conclusion, how do I output individual files for model parameters when using GENMOD with BAYES, files include kernel and density values for parameter?

1 ACCEPTED SOLUTION

Accepted Solutions

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

2 REPLIES 2

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

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

Yes, I was able to track it down using the "ODS TRACE ON" line of code, which had to be on the outside of the 'ODS GRAPHICS ON' line. For any one else in the future looking for kernel data, you can get them with the following code, or also using the PROC KDE code presented further below.

```
ods trace on;
ods graphics on;
ods output TADPanel=output1;
Proc genmod data=my_dataset;
class X1 X2;
model Y = X1 X2 / dist=normal;
bayes seed=12345 outpost=post;
run;
ods graphics off;
ods trace off;
```

Second option, to generate values yourself:

```
proc kde data=post;
ods exclude inputs controls;
Univar name_of_posterior_variable /out=sample;
run;
```

**Available on demand!**

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

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.