proc import
out = StLouis
datafile = '/folders/myfolders/sasuser.v94/all_data/extdata/StLouisData.csv'
dbms = CSV replace;
getnames = YES;
run;
proc print data=StLouis;
run;
proc sort data=StLouis;
by Date StLouis;
run;
ods pdf style=analysis file="StLouis.pdf";
proc sgplot data=StLouis;
loess x=Date y=StLouis / smooth nomarkers lineattrs=(color=blue thickness=2) legendlabel="Economic Conditons Index for St. Louis, MO-IL (MSA)";
run;
proc sort data=StLouis;
by Date RealGDP;
run;
proc sgplot data=StLouis;
loess x=Date y=RealGDP / smooth lineattrs=(color=red thickness=2) legendlabel="Real Gross Domestric Product";
run;
ods pdf close;
It worked out! Thank you for your help:)
update: I didn't mean to select this reply as the correct answer... Since I don't know how to change it, I'll post the code I have right now.
Options papersize=(9in 3in);
ods pdf style=analysis file="/folders/myfolders/sasuser.v94/all_data/extdata/Overall Economy Activity.pdf";
proc sgplot data=StLouis;
loess x=Date y=StLouis / smooth=10 lineattrs=(color=blue thickness=2) legendlabel="Economic Conditons Index for St. Louis, MO-IL (MSA)";
loess x=Date y=RealGDP / smooth=5 lineattrs=(color=red thickness=2) legendlabel="Real Gross Domestric Product";;
keylegend / location=outside position=bottomleft VALUEATTRS=(Size=8);
run;
ods pdf close;
Specify an appropriate value for smooth.
smooth -> smooth=n
(Or you can remove smooth and sgplot will work.)
SGPLOT Procedure / LOESS Statement
It worked out! Thank you for your help:)
update: I didn't mean to select this reply as the correct answer... Since I don't know how to change it, I'll post the code I have right now.
Options papersize=(9in 3in);
ods pdf style=analysis file="/folders/myfolders/sasuser.v94/all_data/extdata/Overall Economy Activity.pdf";
proc sgplot data=StLouis;
loess x=Date y=StLouis / smooth=10 lineattrs=(color=blue thickness=2) legendlabel="Economic Conditons Index for St. Louis, MO-IL (MSA)";
loess x=Date y=RealGDP / smooth=5 lineattrs=(color=red thickness=2) legendlabel="Real Gross Domestric Product";;
keylegend / location=outside position=bottomleft VALUEATTRS=(Size=8);
run;
ods pdf close;
Surely you are supposed to do your homework yourself?
Surely thanks for bumping tho^^
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.