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

Hi

 

I am making Time series Arima model in SAS Guide. I have two columns and need to make a line graph. Two variables should be in the horizontal axis

 

Below is the line graph which I manually made in excel.

 

I want to make it in SAS

 

GRAPH.JPG

 

 

Below is my two variables

Variables.JPG

 

 

Please advise

1 ACCEPTED SOLUTION

Accepted Solutions
sdhilip
Quartz | Level 8

Hi Chris

 

This is my mistake.  I'm unable to get correct coding. 

 

I am running the below ARIMA model

 

/* Creating ARIMA Model for forecast data */
proc arima data=tsforecast; 
identify var=nyse;
estimate p=1 q=1 ; 
forecast out=forecasted2;
run;

I am getting the below output data and stored in forecasted2.

 

ss.JPG

 

 

 

Now I am confused how to take the first two coulmn NYSE forecast and apply into your coding for getting time series plot. Sorry I am not clear in my earlier post.  You have created new data "have" and applied into the SG plot. Could you please guide me how to this with my above output data? Sorry for the inconvinience.

 

 

View solution in original post

5 REPLIES 5
ChrisNZ
Tourmaline | Level 20

Here are two ways:

 

data HAVE;
  do X=1 to 200;
    A+ranuni(1)-.5;
    B+ranuni(1)-.5;
    output; 
  end;
run;
            
proc sgplot data=HAVE;
  series X=X Y=A; 
  series X=X Y=B;
  refline 0;  
run; 

symbol i=j;
proc gplot data=HAVE;
  plot (A B)*X / overlay vref=0;
  run; 
quit;

 

 

Capture .PNGCapture.PNG

Please look up the different options available for the different procedures to tweak the appearance if the default results above are not suitable.

 

 

sdhilip
Quartz | Level 8

Hi Chris

 

Thanks for your solution.  I tried it's not working for me.

 

I am running the ARIMA model and my output data has 5 columns. Among these 5, I have two columns NYSE, FORECAST which I need to do time series plot.

 

I tried to allocate these two columns in the graph but not successful.

 

Any suggestions? I think I am not doing right or may not understand the subject.

 

Cheers,

Dhilip

ChrisNZ
Tourmaline | Level 20

Not too sure what's unclear in my post, or even less sure of what you tried.

What about:

 plot (NYSE FORECAST)*TIME / overlay vref=0;

 

sdhilip
Quartz | Level 8

Hi Chris

 

This is my mistake.  I'm unable to get correct coding. 

 

I am running the below ARIMA model

 

/* Creating ARIMA Model for forecast data */
proc arima data=tsforecast; 
identify var=nyse;
estimate p=1 q=1 ; 
forecast out=forecasted2;
run;

I am getting the below output data and stored in forecasted2.

 

ss.JPG

 

 

 

Now I am confused how to take the first two coulmn NYSE forecast and apply into your coding for getting time series plot. Sorry I am not clear in my earlier post.  You have created new data "have" and applied into the SG plot. Could you please guide me how to this with my above output data? Sorry for the inconvinience.

 

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 5 replies
  • 2529 views
  • 1 like
  • 2 in conversation