I have been struggling with producing SGPLOT for every user in my dataset. Let's say this is the data: data test;
input user $ event number;
datalines;
John 1 100
John 2 150
John 3 200
Roy 1 200
Roy 2 250
Roy 3 300
David 1 600
David 2 150
David 3 800
;
run; The idea is to produce a pdf with a bar chart for every user. I have found an example: data test;
input year month air;
datalines; 1949 1 100
1949 2 150
1949 3 200
1950 1 200
1950 2 250
1950 3 300
1951 1 600
1951 2 150
1951 3 800;
run; data _null_;
do i=1949 to 1955;
call execute(cats('ods pdf file="c:\year_',put(i,4.),'.pdf";)); call execute(cats('title "',put(i,4.),'";'));
call execute(cats('proc sgplot data=test (where=(year=',put(i,4.),')); vbar month/response=air; run;'));
call execute('ods pdf close;');
end;
run; But in my case there is no column which could be used to run the loop on. I can obviously add one, but the reference for the file name and plot data should be the name of the user, not the loop column. It's probably not that difficult but I just don't see it.
... View more