I am trying to run through a large data set and create a simple scatter plot for each person. I would like to run this in SAS using a do loop and proc sgplot.
My dataset is the following:
Person Date QTY Brand
Jim | August 2015 | 20 | Pepsi
Jim | AUgust 2015 | 20 | Coke
Jim | October 2016 | 30 | Pepsi
Jim | November 2016 | 40 | Sprit
Susan | Sept. 2015 | 20 | Dr.Pepper
Susan | Dec. 2016 | 10 | Sprit
Helen | Jan. 2016 | 20 | Coke
Helen | Feb.2016 | 30 | Pepsi
There are many distinct people (n=100). I want to create a scatter plot for each unique person that shows the date on the x axis, and quantity on the y. Then I would like the points grouped by brand.
Currently my code is:
%do i =1 to count(distinct(Person));
proc sgplot data= Original (where=(count = 4))
scatter x=Date y=QTY/ group = Brand;
run;
end;
Any suggestions?