Using 9.2 M3 on Windows XP.
Here's my data:
data mydataset;
length subjid $9.;
infile datalines delimiter=',';
input subjid $ armcd pchg count;
datalines;
001-105-3,1,5.3,1
029-101-4,1,74.1,2
029-107-7,1,65.5,3
029-205-1,2,63,1
029-207-2,2,-62.7,2
001-303-7,3,-10.3,1
025-307-2,3,9.8,2
029-304-0,3,8.9,3
001-401-3,4,57.1,1
001-404-9,4,22,2
001-406-0,4,11.1,3
001-509-3,5,-7.7,1
001-511-2,5,24.3,2
001-512-0,5,0,3
025-506-4,5,-76.6,4
025-507-3,5,23.1,5
025-508-6,5,-17.4,6
029-501-8,5,17.3,7
029-503-4,5,36.4,8
029-505-2,5,-42.2,9
029-513-7,5,31.2,10
001-602-9,6,-33.3,1
001-606-5,6,-18.8,2
025-603-8,6,-51.8,3
029-601-5,6,-67.8,4
029-604-4,6,30.9,5
001-705-7,7,-94.8,1
025-701-7,7,-53.4,2
025-711-1,7,-37.5,3
025-712-7,7,3.3,4
029-703-0,7,9.9,5
029-704-8,7,-0.2,6
029-708-2,7,-0.9,7
;
I can get sort of what I want with
proc sgplot data=mydataset;
by armcd;
vbar subjid / response = pchg stat=sum;
run;
This gives me only the subjects that are in each arm. That is the only part of this that is what I want. What would be better would be panels that contain only the subjects that are each arm.
I tried
proc sgpanel data=mydataset nocycleattrs;
panelby armcd/ columns=7 novarname;
vbar subjid / response = pchg stat=sum nostatlabel barwidth=1;
run;
Having subjid was a bad idea, it tried to cram all 33 values of subjid into each panel. So I added a count variable to the dataset that is just 1 to whatever of subjects in the cohort. That comes a little bit better (just substituting count for subjid in the above code).
I figured I'd attempt GTL to see if I could get more control over the x-axis, but it didn't really work any better.
proc template;
define statgraph bestresp;
begingraph/designwidth=9in designheight=5.5in ;
layout datalattice columnvar=armcd / headerlabeldisplay=value;
layout prototype /cycleattrs=false;
barchart x=count y=pchg/ stat=sum barwidth=0.2;
endlayout;
endlayout;
endgraph;
end;
run;
proc sgrender data=mydataset template=bestresp;
run;
If you take the output from this sgrender and chop out the values of count (or preferably subjid) that don't belong to that armcd value, that's what I'm looking for.
Suggestions?
Thanks! Sue