08-04-2015 06:14 AM
i created graphs, by gplot. i want to change scaling for every graph(i create graph for every security - see by) , how can i drp it?
i.e for every security i have different scale, i want to use scaling inside dataset and to use in the order statement. can i?
for example :
axis1 label=none minor=none offset=(0,0);
axis2 label=none minor=none offset=(0,0) order=(100 to 150 by 5);
proc gplot data=test;
plot price*time=1 / overlay vaxis=axis1 haxis=axes2 noframe;
08-04-2015 08:20 AM
The simple answer is to move your code to use Graph Template Language. Then is really simple:
dynamic _low _high _by;
layout overlay / xaxisopts=(viewmin=_low viewmax=_high);
proc sgrender ...;
dynamic _low=100 _high=150 _by=5;
Otherwise you can do it by generating the code (however do consider moving to the newer technology):
low=100; high=150; b=5; output;
low=200; high=300; b=10; output;
call execute(cats('axis2 order=(',put(low,best.),' to ',put(high,best.),' by ',put(b,best.),';'));
08-05-2015 08:22 AM
Graph template language is the latest graphing technology. Been around since 9.x, the newer graphing plots - sgplot for instance, create GTL behined the scenes. It is far more powerful, easier to understand than the old graphing system. Have a look at Sanjay's excellent blog where you will find examples of pretty much anything you can think of: http://blogs.sas.com/content/graphicallyspeaking/
As for my second options, what I am doing is generating the code. The call execute function takes a string, and sends that string to the compiler as if it was normal code. Thus any string of code you can create can be executed. Say for instance, I want to print two datasets, I could do this as:
call execute(cats('proc print data=',i,'; run;'));
This will create two strings and send them to the compiler as:
proc print data=dataset1; run;
proc print data=dataset2; run;
So from the axis example, the dataset ranges has two rows, in the first row of data an axis statement is generated with the data from that row and sent to the compiler, then the next row. In that instance only the second row really takes any effect, but if you put the graph statement in the call execute, then the gpplot would also be called, so you get two sets of code, one for each of the ranges.
08-04-2015 01:24 PM
Actually the question is for the OP.
Sort of wondering when that appears if maybe what was actually wanted was a
as attempting to overlay multiple graphs with the same marker/line seems odd. IF that was the intent.
08-05-2015 12:44 AM
i will explain what i want to do.
i have a list of securities price and time of transaction. i want to create graph per every security and date, axe x= time axe y =price
i have a lot of securities, for exeery security i want to define the scale of axe y. how can i do it.
i know that using order=() i need put there values, and it is not rellevant in this case.
what can i do?