BookmarkSubscribeRSS Feed
RL876378
Calcite | Level 5
%macro PLOT(var1,data,time,title);
goptions reset=global border cback=white htitle=1.5;
symbol1 interpol=join value=dot height=0.5 color=red;
*symbol2 interpol=join value=none height=0.5 color=blue;
axis1 label=none;
proc gplot data=&data;
plot &var1*&time / haxis=axis1 vaxis=axis2 legend=legend1;
title1 "&title" /*height=0.001 in*/;
run;
quit;
%mend;
%PLOT(Series_A,import1,T,"Plotting series_A") ;
run ;

Hi, I'm trying to plot a time series graph but keep getting an error message in regards to my vaxis code. Also when I use sgplot  the program isn't reading plot &var1*&time / haxis=axis1 vaxis=axis2 legend=legend1;

 

Can anyone help?

4 REPLIES 4
PaigeMiller
Diamond | Level 26

@RL876378 wrote:
%macro PLOT(var1,data,time,title);
goptions reset=global border cback=white htitle=1.5;
symbol1 interpol=join value=dot height=0.5 color=red;
*symbol2 interpol=join value=none height=0.5 color=blue;
axis1 label=none;
proc gplot data=&data;
plot &var1*&time / haxis=axis1 vaxis=axis2 legend=legend1;
title1 "&title" /*height=0.001 in*/;
run;
quit;
%mend;
%PLOT(Series_A,import1,T,"Plotting series_A") ;
run ;

Hi, I'm trying to plot a time series graph but keep getting an error message in regards to my vaxis code. Also when I use sgplot  the program isn't reading plot &var1*&time / haxis=axis1 vaxis=axis2 legend=legend1;

 


For your future benefit (and to continue discussing this problem), when there is an error message, we need to see the LOG of your SAS code. First, please turn on this option and run your code again.

 

options mprint;

We need to see the entire log from a run of this macro, with nothing chopped out, and without you selecting certain portions to show us. That's 100%, all of it, every single character, not just the error message(s). When providing the log, please follow these instructions to preserve the formatting of the log and make it more readable: copy the log as text and then paste it into the window that appears when you click on the </> icon. (Honestly, if you don't preserve the formatting this way, I no longer try to read the log)

--
Paige Miller
RL876378
Calcite | Level 5
%web_drop_table(WORK.IMPORT1);


FILENAME REFFILE '/folders/myfolders/sasuser.v94/PROBLEM SET 2_DATA.xls';
ods listing ;
ods html close ;
ods graphics off ;
PROC IMPORT DATAFILE=REFFILE
DBMS=XLS
OUT=WORK.IMPORT1;
GETNAMES=YES;
RUN;
ods listing ;
ods html close ;
ods graphics off ;
PROC CONTENTS DATA=WORK.IMPORT1; RUN;


%web_open_table(WORK.IMPORT1);
data import1;
set work.import1 ;
T = _n_ ; run ;

ods listing ;
ods html close ;
ods graphics off;

%macro PLOT(var1,data,time,title);
goptions reset=global border cback=white htitle=1.5;
symbol1 interpol=join value=dot height=0.5 color=red;
*symbol2 interpol=join value=none height=0.5 color=blue;
axis1 label=none;
proc gplot data=&data;
plot &var1*&time / haxis=axis1 vaxis=axis2 legend=legend1;
title1 "&title" /*height=0.001 in*/;
run;
quit;
%mend;

%PLOT(Series_A,import1,T,"Plotting Series A") ;
run ;
PaigeMiller
Diamond | Level 26

This is not the LOG, which is what I asked for. You need to turn on the MPRINT option first, run your code, and show me the log according to the instructions I gave.

--
Paige Miller
sbxkoenk
SAS Super FREQ

Hello,

 

Your program stumbles upon

vaxis=axis2

because you don't have an axis2 statement to define that vertical axis!

 

I would still use proc sgplot, sthg. like:

proc sgplot data=sashelp.stocks
  (where=(date >= "01jan2000"d and stock = "IBM"));
  title "Stock Trend";
  series x=date y=close;
  series x=date y=low;
  series x=date y=high;
run;

You get the join interpolation automatically.

Your title statement may give troubles as well, due to too many (nested) quotation marks.

 

Have a nice day,

Koen

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 4 replies
  • 1031 views
  • 2 likes
  • 3 in conversation