01-24-2014 04:56 AM
i have a data table where each row is a customer information, i want to run a procedure (for example Proc gplot) for each customer so for each row.
how can i do that without writing the Proc gplot as many times as the number of customers (actually i have thousands of rows)?
01-24-2014 07:33 AM
input col1 $;
input col1 $ col2;
proc print data=work.data (where=(col1="&txt.")); run;
%let dsid = %sysfunc(open(work.loop,in));
%let nobs = %sysfunc(attrn(&dsid,nlobs));
%do i = 1 %to &nobs;
%let rc = %sysfunc(fetch(&dsid,'NOSET'));
%let col1 = %sysfunc(getvarc(&dsid,%sysfunc(varnum(&dsid,col1))));
%let rc = %sysfunc(close(&dsid));
01-20-2015 02:48 PM
When I do this, I put my graph code in a macro (such as %do_graph), and then loop through the items in a data step, and 'call execute' the macro each time through...
/* Loop through, and make a plot for each manufacturer */
proc sql noprint;
create table loopdata as
select unique statecode
call execute('%do_graph('|| statecode ||');');
01-20-2015 04:26 PM
I find most graphs made with a single point to be less than optimum for most uses...
You may end up restructuring data to get a good result from SAS graphical procs compared with the choices you may make with Excel or similar programs.