03-12-2018 02:32 PM
Is there a way to create a whole series of individual time series plots utilizing a macro (for all my independent variables, i.e. '&indvar') over a series of years (C_EDDYR)? (each plot would represent each individual '&indvar' by year)
I was able to get my trend test to work with the macro variable (see below):
proc freq data=t;
tables C_EDDYR*(&indvar) / trend;
...but now, when I try various 'plotting codes' with the macro (to plot the trend I get statistics on above), I'm not able to get what I'm looking for:
/*try to plot time trend*/
proc gplot data=t;
symbol1 v=star c=blue;
title "Time Series Plot for (&indvar) and Year of Estimated Delivery";
proc sgpanel data=t ;
series x=C_EDDYR y=(&indvar);
Any assistance would be greatly appreciated.
-Taylor (using SAS V 9.4)
03-12-2018 05:57 PM
So, you haven't written a macro, and you haven't given the macro variable &indvar a value.
But a macro isn't needed here. Nor is a macro variable needed here. Unless there are other complications you haven't told us about.
Use the search and replace option in the SAS editor to replace the string "&indvar" with the corresponding string of variables that you are interested in. Done. No macros. No macro variables.
03-13-2018 09:01 AM
03-13-2018 11:25 AM
Okay, I see now. Macros are usually used to create dynamic code, which can change depending on other pieces of data (for example, if the user requests the analysis for North America, you may have different variables than if the request is for Europe).
In your case, you seem to be using the macro variable to save some typing, certainly a valid use of macro variables (I do that sometimes too).
So, you need to turn on some options
options mprint mlogic symbolgen;
and then run the code. I would need to see the SASLOG to determine what is the problem here.
03-13-2018 04:03 PM
03-13-2018 05:57 PM
This is very frustrating, because nowhere have you actually ever stated what the problem is, other than you need help with macros. What is the problem you see when you run this code?
There is a warning about the title statement, is that the problem? Or something else?
03-14-2018 10:24 AM
03-14-2018 10:31 AM
This is very vague as well. The Cochran-Armitage test is a statistic, a single number, I don't understand the concept of plotting a single number.
03-14-2018 10:41 AM
03-21-2018 11:18 PM
proc freq data=Pain; tables Adverse*Dose / trend measures cl plots=freqplot(twoway=stacked) out=freq_counts; test smdrc; exact trend / maxtime=60; weight Count; title 'Clinical Trial for Treatment of Pain'; run; proc sgplot data=freq_counts; title 'Adverse By Dose'; series x=dose y=count / group=adverse markers markerattrs=(symbol=circlefilled) datalabel; run;
produces the line chart in the screen shot below.