BookmarkSubscribeRSS Feed
karen8169
Obsidian | Level 7
Data sp;
infile " E:\Appmethod2016\SAS-1209\SP500.csv " dlm=',' firstobs=2;
input  date spopen sphigh splow spclose spvol spaclose;
Informat date anydtdte.;
run;

Data mt;
infile " E:\Appmethod2016\SAS-1209\Moto.csv " dlm=',' firstobs=2;
input  date mtaopen mtahigh mtalow mtaclose mtavol mtaaclose;
Informat date anydtdte.;
run;

data Stocks;
merge sp mt;
spret=100*(spaclose-lag1(spaclose))/lag1(spaclose);
mtret =100*(mtaclose-lag1(mtaclose))/lag1(mtaclose);
dow=weekday(date);
run;

proc means data= stocks mean median std skew kurt min max n maxdec=3;
var spret mtret;
run;

proc format;
value dowf
1='Sun'
2='Mon'
3='Tue'
4='Wed'
5='Thu'
6='Fri'
7='Sat';
run;

proc sort data = stocks out= a;
format dow dowf.;
by dow;
run;

proc means data = a mean median std skew kurt min max n maxdec=3;
by dow;
var spret mtret ;
run;

proc sgplot data= stocks noautolegend;
title 'S&P 500 Returns by Day of the Week';
format dow dowf.;
vbox spret / category=dow;
xaxis label=' ';
yaxis label='Return (%)' grid;
refline 0;
run;

proc sgplot data=stocks;
title 'S&P 500 and Motorola Daily Returns';
reg x=spret y=mtret;
ellipse x=spret y=mtret/ alpha =.01;
ellipse x=spret y=mtret/ alpha =.001;
xaxis label='S&P 500 Return (%)';
yaxis label='Motorola Return (%)';
run;

proc reg data =stocks;

model mtret= spret;

proc reg data =stocks;

model mtret=spret ;
run;

I want to get scatter plots with the fit line but the system always give me heat maps.

The system claims that I can use PLOTS(MAXPOINTS= ) to solve it, but where I should insert it.

Thanks.

2 REPLIES 2
PGStats
Opal | Level 21

Try

 

proc reg data =stocks plots(only maxpoints=none)=fit;
model mtret=spret ;
run;
PG
Rick_SAS
SAS Super FREQ

Read the article "New heat maps in the REG procedure."  At the end it describes how to control whether the procedure uses heat maps or scatter plots. To quote from the article:

"In SAS 12.1 the MAXPOINTS= option accepts two arguments, and the default values are MAXPOINTS=5000 150000. The first argument specifies the data size for which heat maps are used instead of scatter plots. The documentation of the MAXPOINTS= option states that "when the number of points exceeds [the first number] but does not exceed [the second number] divided by the number of independent variables, heat maps are displayed instead of scatter plots for the fit and residual plots." In other words, if you have a regression with k explanatory variables, heat maps are used when the number of observations is between 5,000 and 150,000/k. Of course, you can use the MAXPOINTS= option to change either or both of those values."

 

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

Discussion stats
  • 2 replies
  • 724 views
  • 0 likes
  • 3 in conversation