turn on suggestions

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

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- Proc sgpanel

Topic Options

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-09-2014 01:21 PM

Hi,

I have a dataset at the person-level (one row=one person). Each person is divided into one of three categories for Var 1, and one of two categories for Var2. Each person also has a value for two continuous variables, Var3, and Var4. What I want is to be able to plot kernel density curves for the sum of Var3 and Var4, one curve for each level of Var1, and one panel for each level of Var2.

In the previous step, I merged two datasets by ID (Var 3 and Var 4 were on different datasets). I also created Var 5, which was the sum of Vars 3 and 4. Then I divided the sum variable into three variables which were populated based on a person's level of Var 1. In other words, if they were level 1 of Var 1, their sum (Var 5) would go under Var5_lvl1, if level 2, Var5_lvl2, and if lvel 3, Var5_lvl3.

The following is the code I'm trying to use to calculate the curves:

proc sgpanel data=data;

panelby Var2;

density Var5_lvl1 /type=kernel ;

density Var5_lvl2/type=kernel;

density Var5_lvl3/type=kernel;

run;

I get an error message that there was a problem computing the data for the histogram or density statement. I'm not really sure why it's having a problem, as the same code worked on a similar dataset I had earlier.

Any help is much appreciated.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-09-2014 01:46 PM

Could you provide the exact error message (or the relevant portion of the SAS log)? To find out if it is PROC SGPLOT or your data, you could try the following (assuming data are sorted by Var2):

proc kde data=data;

by Var2;

univar Var5_lvl1 Var5_lvl2 Var5_lvl3 / plots=densityoverlay;

run;