[using EG 9.4]
I have a data set that looks like this:
product sale_date price abc 01/01/2018 1.13 abc 06/01/2018 1.29 abc 02/02/2018 1.23 xyz 02/01/2018 1.54 xyz 08/01/2018 1.58 xyz 03/02/2018 1.41
And I need to plot two series (one for each product) on a pbspline plot of "price vs date".
I have tried a number of variations but am unable to get two separate series. Here's what I used most recently:
ods graphics on / height=600 width=900 noborder;
proc sgplot data=work.product_daily_sales(where=(product IN ('abc', 'xyz')));
by product;
pbspline x=sale_date y=price / legendlabel='company1' markerattrs=(symbol=circle color=blue size=5) lineattrs=(color=blue);
pbspline x=sale_date y=price / legendlabel='company2' markerattrs=(symbol=circle color=red size=5) lineattrs=(color=red);
xaxis label='Date';
yaxis label='US Price ($)';
title 'Sales Price by date of sale';
run;
quit;
Basically, I am comparing prices for a similar product to two different companies and I need to show the difference in pricing on the one graph.
The above code gets me closest to what I want but displays two graphs.
Can anyone help?
Thanks in advance.
ods graphics on / height=600 width=900 noborder;
proc sgplot data=work.product_daily_sales(where=(product IN ('abc', 'xyz')));
pbspline x=sale_date y=price / group=product markerattrs=(symbol=circle color=blue size=5) lineattrs=(color=blue);
xaxis label='Date';
yaxis label='US Price ($)';
title 'Sales Price by date of sale';
run;
@chuckd wrote:
[using EG 9.4]
I have a data set that looks like this:
product sale_date price abc 01/01/2018 1.13 abc 06/01/2018 1.29 abc 02/02/2018 1.23 xyz 02/01/2018 1.54 xyz 08/01/2018 1.58 xyz 03/02/2018 1.41And I need to plot two series (one for each product) on a pbspline plot of "price vs date".
I have tried a number of variations but am unable to get two separate series. Here's what I used most recently:
ods graphics on / height=600 width=900 noborder; proc sgplot data=work.product_daily_sales(where=(product IN ('abc', 'xyz'))); by product; pbspline x=sale_date y=price / legendlabel='company1' markerattrs=(symbol=circle color=blue size=5) lineattrs=(color=blue); pbspline x=sale_date y=price / legendlabel='company2' markerattrs=(symbol=circle color=red size=5) lineattrs=(color=red); xaxis label='Date'; yaxis label='US Price ($)'; title 'Sales Price by date of sale'; run; quit;
Basically, I am comparing prices for a similar product to two different companies and I need to show the difference in pricing on the one graph.
The above code gets me closest to what I want but displays two graphs.
Can anyone help?
Thanks in advance.
ods graphics on / height=600 width=900 noborder;
proc sgplot data=work.product_daily_sales(where=(product IN ('abc', 'xyz')));
pbspline x=sale_date y=price / group=product markerattrs=(symbol=circle color=blue size=5) lineattrs=(color=blue);
xaxis label='Date';
yaxis label='US Price ($)';
title 'Sales Price by date of sale';
run;
@chuckd wrote:
[using EG 9.4]
I have a data set that looks like this:
product sale_date price abc 01/01/2018 1.13 abc 06/01/2018 1.29 abc 02/02/2018 1.23 xyz 02/01/2018 1.54 xyz 08/01/2018 1.58 xyz 03/02/2018 1.41And I need to plot two series (one for each product) on a pbspline plot of "price vs date".
I have tried a number of variations but am unable to get two separate series. Here's what I used most recently:
ods graphics on / height=600 width=900 noborder; proc sgplot data=work.product_daily_sales(where=(product IN ('abc', 'xyz'))); by product; pbspline x=sale_date y=price / legendlabel='company1' markerattrs=(symbol=circle color=blue size=5) lineattrs=(color=blue); pbspline x=sale_date y=price / legendlabel='company2' markerattrs=(symbol=circle color=red size=5) lineattrs=(color=red); xaxis label='Date'; yaxis label='US Price ($)'; title 'Sales Price by date of sale'; run; quit;
Basically, I am comparing prices for a similar product to two different companies and I need to show the difference in pricing on the one graph.
The above code gets me closest to what I want but displays two graphs.
Can anyone help?
Thanks in advance.
Thanks. I was almost there.
In cases like this, how do you change the marker and line attributes of the different series (products in this case)? So they're both not in blue.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.