%splitby(NEWD,18);
run;
ods graphics /reset imagename='Final'
imagefmt=jpeg height=3 in width=6 in;
ods listing gpath= "/folders/myfolders/FITGRAPHS_CONC/" ;
%MACRO TEST;
%DO i=1% TO 34;
DATA NEWD&i;
SET WORK.FIT&i;
PROC SGPANEL DATA =NEWD&i;
PANELBY ID/columns=3 rows=2 ;
scatter x=TIME y=OBS;
series x=TIME y=CONC;
series x=TIME y=PRED /lineattrs=(color=red pattern=dash);
run;
RUN;
%end;
%mend TEST;
%TEST
The attached code was used to split a larger file into 34 smaller files to be plotted in SGPANEL. It runs okay. The graph creates a matrix of 3 columns and 2 rows. The only problem is that a graph is in only one column while all the others are blank. Can someone tell me how to get the code to populate all 6 panels?
See an examples.
To use PROC SGPANEL, you do not need to break up the files or use a macro. You just give it the data and specify the size of each panel. Here is an example on some simulated data:
data Have;
do ID = 1 to 34;
do i = 1 to 40;
Time = rand("Normal");
Pred = sin(Time);
Obs = sin(Time) + rand("Normal", 0, 0.25);
output;
end;
end;
run;
proc sort data=Have;
by ID Time;
run;
PROC SGPANEL DATA =Have;
PANELBY ID/columns=3 rows=2 ;
scatter x=TIME y=OBS;
series x=TIME y=PRED;
run;
To use PROC SGPANEL, you do not need to break up the files or use a macro. You just give it the data and specify the size of each panel. Here is an example on some simulated data:
data Have;
do ID = 1 to 34;
do i = 1 to 40;
Time = rand("Normal");
Pred = sin(Time);
Obs = sin(Time) + rand("Normal", 0, 0.25);
output;
end;
end;
run;
proc sort data=Have;
by ID Time;
run;
PROC SGPANEL DATA =Have;
PANELBY ID/columns=3 rows=2 ;
scatter x=TIME y=OBS;
series x=TIME y=PRED;
run;
Worked perfectly. I didn't know that one did not have to split the data set just sort it for SGpanel.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: