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
Super User

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
Super User

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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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