BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
dustychair
Pyrite | Level 9

Hi all,

I two numeric-Continuous variables. I'd like to draw a distribution where one continues variable x-axis and the other one is y-axis. I draw scatter plots with the curve but I don't want dots in the graph. It should be more like Kernel or Normal distribution. However, as I know I can draw Kernel or Normal distribution with only one variable using density. I want a distribution as seen below.

 

Could you help me to draw it?

 

Thanks.

preview.jpg

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Using @PeterClemmensen's data set.

 

Maybe:

proc sgplot data=have;
   pbspline x=scores y=ss;
run;

or

proc sgplot data=have;
   reg x=scores y=ss / degree=3 nomarkers;
run;

We kind of need a bit more description of your expectations than "no dots".

View solution in original post

6 REPLIES 6
PeterClemmensen
Tourmaline | Level 20

Can you post your data or a sample of it?

dustychair
Pyrite | Level 9

Sure, Here it is! It is in the attachment.

Thanks

dustychair
Pyrite | Level 9

the scores will be x-axis and ss will be y-axis.

 

Thanks

PeterClemmensen
Tourmaline | Level 20

I'm not really sure how you expect this data to yield a plot like you posted. However, to get things started, you can fit a normal density plot like this

 

data have;
input scores ss;
datalines;
920 5.5
941 6.3
935 8.2
910 9.5
972 10.5
954 .
925 9.2
900 8.7
;

proc sgplot data=have;
   density ss;
run;
ballardw
Super User

Using @PeterClemmensen's data set.

 

Maybe:

proc sgplot data=have;
   pbspline x=scores y=ss;
run;

or

proc sgplot data=have;
   reg x=scores y=ss / degree=3 nomarkers;
run;

We kind of need a bit more description of your expectations than "no dots".

dustychair
Pyrite | Level 9

Thank you so much!

I tried the second one and it worked!

 

Thank you!

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1393 views
  • 1 like
  • 3 in conversation